Je développe un petit programme qui affiche dans une premier fenêtre 2 radioBox et un bouton.
Le choix de l'un des bouton déclenche l'ouverture d'une fenêtre secondaire avec d'autres boutons.
Je n'arrive pas à récuperer les action sur ces bouton.
Je pense que je n'ai pas bien compris comment fonctionne AutoIT, d'ou mon interrogation.
Je vous joins un bout de code simplifié pour m'aider si vous le souhaitez.
Me donner une solution serait un plus, mais l'explication ne serait bien plus utile pour d'autre développement .
Merci de votre aide.
► Afficher le texte
Code : Tout sélectionner
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.8.1
Author: Megaten
#ce ----------------------------------------------------------------------------
#include <GUIConstantsEx.au3>
#include <Misc.au3>
Local $font
$Form_header = "Camping-Car Info"
$inst = "Installation de l'application CCI"
$DriveKeyLetter = "C:"
;Creation du menu principal de sélection
$Main_frm = GUICreate("Installation application Camping-car Info CCI", 400, 200)
GUISetBkColor(0xE0FFFF, $Main_frm) ; will change background color
GUICtrlCreateLabel("Sélectionnez le type d'utilisation de CCI", 50, 10, 400, 50)
GUICtrlSetFont(-1, 12, 700, 4, $font, 5) ; will display italic characters
Local $radio1, $radio2, $msg
$radioUSB = GUICtrlCreateRadio("A partir de la clé USB .", 20, 50, 250, 50)
$radioHDD = GUICtrlCreateRadio("A partir de votre disque ( Plus rapide).", 20, 80, 250, 50)
#GUICtrlSetState($radio2, $GUI_CHECKED) ; Pas de selection par défaut
$BtnFermer = GUICtrlCreateButton("Fermer", 160, 150, 60)
; Cette fonction permet la selection du dossier d'installation de l'application
$text = "Sélectionner votre dossier d'installation, puis lancer l'installation"
$Hdd_Frm = GUICreate($Form_header, 500, 200, 400, 200)
GUISetBkColor(0xE0FFFF,$Hdd_Frm) ; will change background color
$Label = GUICtrlCreateLabel($text, 10, 30, 450, 150)
$font = GUICtrlSetFont(-1, 10, 700, 4, $font, 5) ; will display italic characters
$Input = GUICtrlCreateInput("", 40, 100, 300, 20)
$BtnParcourir = GUICtrlCreateButton("Parcourir", 360, 97, 75, 25)
$BtnInstall = GUICtrlCreateButton("Lancer l'installation", 80, 150, 200, 25)
$BtnCancel = GUICtrlCreateButton("Annuler l'installation", 360, 150, 120, 25)
MsgBox(0, "ID bouton Wind 1: ", $Main_frm & " ** " & $radioUSB & " * " & $radioHDD & " * " & $BtnFermer, 5)
MsgBox(0, "ID bouton Wind 2: ", $Hdd_Frm & " ** " & " * " & $Label & " * " & $Input & " * " & $BtnParcourir & " * " & $BtnInstall & " * " & $BtnCancel, 5)
; On s'assure qu'il n'y a pas une autre instance du script en cours
If _Singleton("Install_CCI", 1) = 0 Then
MsgBox(0, "Warning", "L'installation de l'application CCI est déjà en cours.")
Exit
EndIf
;Ouverture fenetre principale
GUISetState(@SW_SHOW,$Main_frm)
; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
Select
Case $msg = $radioUSB ;And BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED
Install_USB()
Case $msg = $radioHDD ;And BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED
Install_HDD()
Case $msg = $BtnFermer Or $msg = $GUI_EVENT_CLOSE
Exit
EndSelect
WEnd
Exit ; Fin du programme
Func Install_USB()
MsgBox ( 4096, "USB install", "Installation terminée", 4)
Exit
EndFunc ;==>Install_USB
Func Install_HDD()
;Affichage fenêtre secondaire
GUISetState (@SW_SHOW,$Hdd_Frm) ; Secondary windows
;Choix du dossier d'installation
Local $rmsg = ""
While 1
$nMsg = GUIGetMsg()
Select
Case $nMsg = $BtnParcourir
Local $var = FileSelectFolder("Choississez votre dossier d'installation.", " ")
If @error Then
MsgBox(4096, "", "Pas d'emplacement sélectionné, arrêt de l'installation?")
$rmsg = "Not OK"
ExitLoop
Else
$var = StringTrimRight($var, 1) & "\CCI"
GUICtrlSetData($Input, $var)
;ContinueLoop volontaire pour permettre l'action sur le bouton 'Lancer l'installation'
EndIf
Case $nMsg = $BtnInstall
GUIDelete(); ; will return 1
$rmsg = "OK"
Case $nMsg = $BtnCancel Or $nMsg = $GUI_EVENT_CLOSE ; Close the GUI
$rmsg = "Cancel"
ExitLoop
Case Else
;MsgBox(0, "Default Case", "No preceding case was true!" & " * " & $nmsg & " * " & $BtnParcourir & " * " & $BtnInstall & " * " & $BtnCancel, 5)
EndSelect
WEnd
MsgBox(4096, "", "rmsg:" & $rmsg & " * " & $nmsg, 5)
If $rmsg = "Cancel" then
MsgBox(4096, "CCI Info:", "L'installation de l'application CCI a été abandonnée.",4)
Exit
ElseIf $rmsg = "OK" then
MsgBox(4096, $Form_header, "Copie des fichiers.",3)
MsgBox(4096, $Form_header, "HDD: L'installation de l'application CCI est terminée.",4)
Exit
EndIf
;MsgBox(4096, $Form_header, "HDD: Return: " & $result,4)
EndFunc ;==>Install_HDD