[..] Utilisation des GUI

Aide sur les Interfaces Graphique Utilisateurs (GUI).
Règles du forum
.
Répondre
axelzorl
Niveau 1
Niveau 1
Messages : 1
Enregistré le : mer. 18 avr. 2012 15:14
Status : Hors ligne

[..] Utilisation des GUI

#1

Message par axelzorl »

[..] Utilisation des GUI
Bonjour,
Comment Faire pour récuperer l'etat des checkbox ou des option1?
Avez vous un exemple complet d'utilisation de GUI avec checkbox et option?

Merci

[*]

Code : Tout sélectionner

voici une partie de mon code
$Form1 = GUICreate("Form1", 623, 442, 192, 124)
$Fin = GUICtrlCreateButton("Fin", 56, 352, 209, 49)
$Creation = GUICtrlCreateButton("Creation", 56, 296, 209, 49)
$Group1 = GUICtrlCreateGroup("2G", 32, 40, 257, 129)
$Tronc_Commun = GUICtrlCreateCheckbox("80000086", 48, 64, 161, 25)
$Version142 = GUICtrlCreateRadio("84500145", 48, 96, 233, 33)
$Version143 = GUICtrlCreateRadio("DC/DC", 48, 136, 193, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Options", 312, 40, 201, 153)
$Option1 = GUICtrlCreateCheckbox("Option1", 336, 72, 145, 25)
GUICtrlSetState(-1, $GUI_Enable)
$Option2 = GUICtrlCreateCheckbox("Option2", 336, 102, 145, 25)
GUICtrlSetState(-1, $GUI_ENABLE)
$Option3 = GUICtrlCreateCheckbox("Option3", 336, 131, 145, 25)
GUICtrlSetState(-1, $GUI_ENABLE)

GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###



GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$fic_tronc=""
$fic_version=""
;$fic_version143=""
$path= "C:\DossierTest\dossiercontrole\"
$fic_resultat = ""
$ficracine = "80000086_"
$pdftk = $path & "pdftk.exe "
$opt1=""
$opt2=""
$opt3=""
$fic_Option1 = ""
$fic_Option2 = ""
$fic_Option3 = ""
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        case $FIN
            exit

        Case $Radio1
        GUISetState
        $opt1="_146"
        $fic_Option1 = "84500146.pdf"

        Case $Radio2
        $opt2="_147" 
        $fic_Option2 = "84500147.pdf"
        Case $Radio3
        $opt3="_148" 
        $fic_Option3 = "84500148.pdf"

        case $Tronc_commun
            $fic_tronc="80000086.pdf"
            ;MsgBox(0, "Tron", "Tronc commun.")
        case $Version142
            $fic_version="84500142.mes.pdf"
            $fic_resultat ="84500142"
;           $Radio1 = GUICtrlCreateCheckbox("Option1", 336, 72, 145, 25)
;           GUICtrlSetState(-1, $GUI_ENABLE);
;           $Radio2 = GUICtrlCreateCheckbox("Option2", 336, 102, 145, 25)
;           GUICtrlSetState(-1, $GUI_ENABLE)
;           $Radio3 = GUICtrlCreateCheckbox("Option3", 336, 131, 145, 25);
;           GUICtrlSetState(-1, $GUI_ENABLE)
            ;MsgBox(0, "142", "Version 142.")
        case $Version143
            $fic_version="84500143.pdf"
            $fic_resultat ="84500143"
;           $Radio1 = GUICtrlCreateCheckbox("Option1", 336, 72, 145, 25)
;           GUICtrlSetState(-1, $GUI_ENABLE)
;           $Radio2 = GUICtrlCreateCheckbox("Option2", 336, 102, 145, 25)
;           GUICtrlSetState(-1, $GUI_ENABLE)
;           $Radio3 = GUICtrlCreateCheckbox("Option3", 336, 131, 145, 25)
;           GUICtrlSetState(-1, $GUI_ENABLE)

            ;MsgBox(0, "143", "Version 143.")
        case $Creation
        ;   $pdfttkCommand = $pdftk & $path & $fic_tronc & " " & $path & $fic_version & " " & $path & $fic_Option1 & " " & $path & $fic_Option2 & " " & $path & $fic_Option3 & " cat output " & $path & $ficracine & $fic_resultat & $opt1 & $opt2 & $opt3 & ".mes.pdf"           ; lancement du traitement des commandes PIO
            $pdfttkCommand = $pdftk &  $fic_tronc & " " & $fic_version & " " &  $fic_Option1 & " " &  $fic_Option2 & " " &  $fic_Option3 & " cat output " & $path & $ficracine & $fic_resultat & $opt1 & $opt2 & $opt3 & ".mes.pdf"           ; lancement du traitement des commandes PIO
            MsgBox(0, "143", $pdfttkCommand)
            $val = Run($pdfttkCommand)
            $fic_resultat = ""
            $fic_Option1 = ""
            $fic_Option2 = ""
            $fic_Option3 = ""
            $opt1=""
            $opt2=""
            $opt3=""

            $pdfttkCommand =""
            $fic_version=""
;           $Creation = GUICtrlCreateButton("Creation", 56, 296, 209, 49)
;           $Group1 = GUICtrlCreateGroup("EM9000 2G", 32, 40, 257, 129)'
;           $Tronc_Commun = GUICtrlCreateCheckbox("80000086", 4'8, 64, 161, 25)
;           $Version142 = GUICtrlCreateRadio("84500145", 48, 96, 233, 33)
;           $Version143 = GUICtrlCreateRadio("Version", 48, 136, 193, 17)
;           GUICtrlCreateGroup("", -99, -99, 1, 1)
;           $Group2 = GUICtrlCreateGroup("Options", 312, 40, 201, 153)
;           $Radio1 = GUICtrlCreateRadio("Option1", 336, 72, 145, 25)
;           GUICtrlSetState(-1, $GUI_DISABLE)
;           $Radio2 = GUICtrlCreateRadio("Option2", 336, 102, 145, 25)
;           GUICtrlSetState(-1, $GUI_DISABLE)
;           $Radio3 = GUICtrlCreateRadio("Option3", 336, 131, 145, 25)
;           GUICtrlSetState(-1, $GUI_DISABLE)
;           GUICtrlCreateGroup("", -99, -99, 1, 1)
;           GUISetState(@SW_SHOW)

            ;MsgBox(0, "Creation", "Creation.")
    EndSwitch
WEnd
Avatar du membre
TT22
Membre émérite
Membre émérite
Messages : 1566
Enregistré le : lun. 18 avr. 2011 15:21
Localisation : La Quatrième Dimension
Status : Hors ligne

Re: [..] Utilisation des GUI

#2

Message par TT22 »

Pour une CheckBox : GUICtrlRead() retourne 4 si elle n'est pas coché, et 1 si elle l'est.
Cordialement,
TT22
Avatar du membre
blacksoul305
Membre émérite
Membre émérite
Messages : 957
Enregistré le : ven. 18 mars 2011 11:49
Localisation : Au pays des programmeurs.
Status : Hors ligne

Re: [..] Utilisation des GUI

#3

Message par blacksoul305 »

Sinon y a ça :

Code : Tout sélectionner

Func _IsChecked($control) ; regarder si une radio/check box est activée/cochée
    Return BitAND(GUICtrlRead($control), $GUI_CHECKED) = $GUI_CHECKED
EndFunc   ;==>_IsChecked
Exemple :

Code : Tout sélectionner

If _IsChecked($CheckBox1) Then
MsgBox(64,"Ouaw","Vous avez coché la boite")
EndIf
Étudiant en 2ème année de Licence Informatique.
Répondre