Page 1 sur 1
[R] Activer plusieurs checkbox avec une checkbox
Posté : dim. 11 déc. 2011 18:34
par Shyke74
bonjour,bonsoir voila je cherche a activer et desactiver 4 checkbox quand l'on appuie sur 1 checkbox voila mon exemple tout simple
► Afficher le texte
Code : Tout sélectionner
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("exemple activer toute les checkbox", 225, 204, 354, 237)
$Checkbox1 = GUICtrlCreateCheckbox("selectionner toute les option", 7, 3, 192, 32)
$Checkbox2 = GUICtrlCreateCheckbox("option A", 6, 54, 186, 37)
$Checkbox3 = GUICtrlCreateCheckbox("option B", 6, 81, 123, 47)
$Checkbox4 = GUICtrlCreateCheckbox("option C", 5, 123, 75, 31)
$Checkbox5 = GUICtrlCreateCheckbox("option D", 4, 152, 107, 39)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
j'ai cherché dans l'aide de autoit mais a part un petit fichier sur les checkbox rien d'interessant j'ai aussi cherché sur le forum mais rien non plus je fais appelle a vos conaissance pour m'aider merci
Re: [..] Activer plusieurs checkbox avec une checkbox
Posté : dim. 11 déc. 2011 18:45
par PandiPanda
Bonsoir,
ceci et
ceci
devrai vous aider !
Re: [..] Activer plusieurs checkbox avec une checkbox
Posté : dim. 11 déc. 2011 20:00
par Shyke74
merci mais,pouvais vous me donner un exemple concret svp je vous en serait tres reconaissant merci
Re: [..] Activer plusieurs checkbox avec une checkbox
Posté : dim. 11 déc. 2011 20:15
par matwachich
► Afficher le texte
Code : Tout sélectionner
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <ButtonConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("exemple activer toute les checkbox", 225, 204, 354, 237)
$Checkbox1 = GUICtrlCreateCheckbox("selectionner toute les option", 7, 3, 192, 32)
$Checkbox2 = GUICtrlCreateCheckbox("option A", 6, 54, 186, 37)
$Checkbox3 = GUICtrlCreateCheckbox("option B", 6, 81, 123, 47)
$Checkbox4 = GUICtrlCreateCheckbox("option C", 5, 123, 75, 31)
$Checkbox5 = GUICtrlCreateCheckbox("option D", 4, 152, 107, 39)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Checkbox1
Switch GuiCtrlRead($Checkbox1)
Case $GUI_CHECKED
GuiCtrlSetState($Checkbox2, $GUI_CHECKED)
GuiCtrlSetState($Checkbox3, $GUI_CHECKED)
GuiCtrlSetState($Checkbox4, $GUI_CHECKED)
GuiCtrlSetState($Checkbox5, $GUI_CHECKED)
Case $GUI_UNCHECKED
GuiCtrlSetState($Checkbox2, $GUI_UNCHECKED)
GuiCtrlSetState($Checkbox3, $GUI_UNCHECKED)
GuiCtrlSetState($Checkbox4, $GUI_UNCHECKED)
GuiCtrlSetState($Checkbox5, $GUI_UNCHECKED)
EndSwitch
EndSwitch
WEnd
Ou bien (plus simple)
► Afficher le texte
Code : Tout sélectionner
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <ButtonConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("exemple activer toute les checkbox", 225, 204, 354, 237)
$Checkbox1 = GUICtrlCreateCheckbox("selectionner toute les option", 7, 3, 192, 32)
$Checkbox2 = GUICtrlCreateCheckbox("option A", 6, 54, 186, 37)
$Checkbox3 = GUICtrlCreateCheckbox("option B", 6, 81, 123, 47)
$Checkbox4 = GUICtrlCreateCheckbox("option C", 5, 123, 75, 31)
$Checkbox5 = GUICtrlCreateCheckbox("option D", 4, 152, 107, 39)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Checkbox1
$status = GuiCtrlRead($Checkbox1)
GuiCtrlSetState($Checkbox2, $status)
GuiCtrlSetState($Checkbox3, $status)
GuiCtrlSetState($Checkbox4, $status)
GuiCtrlSetState($Checkbox5, $status)
EndSwitch
WEnd
Ou bien (plus professionnel, plus propre (à mon avis) et avec moins de code)
► Afficher le texte
Code : Tout sélectionner
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <ButtonConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("exemple activer toute les checkbox", 225, 204, 354, 237)
$Checkbox1 = GUICtrlCreateCheckbox("selectionner toute les option", 7, 3, 192, 32)
$Checkbox2 = GUICtrlCreateCheckbox("option A", 6, 54, 186, 37)
$Checkbox3 = GUICtrlCreateCheckbox("option B", 6, 81, 123, 47)
$Checkbox4 = GUICtrlCreateCheckbox("option C", 5, 123, 75, 31)
$Checkbox5 = GUICtrlCreateCheckbox("option D", 4, 152, 107, 39)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Checkbox1
$status = GuiCtrlRead($Checkbox1)
For $i = 2 To 5
GuiCtrlSetState(Eval("Checkbox" & $i), $status)
Next
EndSwitch
WEnd
Re: [..] Activer plusieurs checkbox avec une checkbox
Posté : dim. 11 déc. 2011 20:17
par Shyke74
super, merci pour tous c'est exemple je change le statut du post encore merci