robinsiebler Posted June 4, 2012 Share Posted June 4, 2012 I have a form with 2 dialogs. When I display the 2nd dialog, the events for the OK/Cancel button do not seem to be firing. I looked at the Wiki for Multiple forms, but I couldn't tell if it applied to this case or how to adapt it to my script. Any help would be appreciated. To get the 2nd dialog to appear, Select 'Citrix HDX' for 'Product'. expandcollapse popup; Includes #include<file.au3> #include<array.au3> #include<date.au3> #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) ; Variables Global $Branch, $Product, $Type, $Options, $Component, $BuildFolder Local $IniFile = @ScriptDir & "\Build_Auto_Installer.ini" Local $ConfigData = IniReadSection($IniFile, "Config") $BuildFolder = "\\hqfile04\Build\releases" ;----------------------- Build Selection Dialog ---------------------------------------- #Region ### START Koda GUI section ### Form=f:\scripts\autoit\build auto installer\buildselectiondialog.kxf $Form1 = GUICreate("Build Auto Installer", 297, 261, 194, 154, BitXOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX, $WS_MINIMIZEBOX)) GUISetIcon("F:\scripts\AutoIt\Build Auto Installer\avistar.ico", -1) GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close") $Label1 = GUICtrlCreateLabel("Please choose from the below options to install a build:", 16, 32, 261, 17, 0) $Label2 = GUICtrlCreateLabel("Branch:", 40, 56, 41, 17, 0) $Label3 = GUICtrlCreateLabel("Product:", 40, 88, 44, 17, 0) $Label4 = GUICtrlCreateLabel("Type:", 40, 120, 31, 17, 0) $Label5 = GUICtrlCreateLabel("Options:", 40, 152, 43, 17, 0) $CB_Branch = GUICtrlCreateCombo("", 88, 56, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, $ConfigData[1][1]) $CB_Product = GUICtrlCreateCombo("", 88, 88, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, $ConfigData[2][1]) $CB_Type = GUICtrlCreateCombo("", 88, 120, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, $ConfigData[4][1]) $CB_Options = GUICtrlCreateCombo("", 88, 152, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, $ConfigData[5][1]) $Btn_OK = GUICtrlCreateButton("OK", 72, 208, 49, 25, $BS_NOTIFY) GUICtrlSetOnEvent($Btn_OK, "SetBuildOptions") $Btn_Cancel = GUICtrlCreateButton("Cancel", 144, 208, 49, 25, $BS_NOTIFY) GUICtrlSetOnEvent($Btn_Cancel, "ProcessCancel") GUISetState(@SW_SHOW, $Form1) #EndRegion ### END Koda GUI section ### ;----------------------- Component Selection Dialog ---------------------------------------- #Region ### START Koda GUI section ### Form=F:\scripts\AutoIt\Build Auto Installer\ComponentSelectionDialog.kxf $Form2 = GUICreate("Select Component", 228, 145, 194, 470, BitXOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX, $WS_MINIMIZEBOX)) GUISetIcon("F:\scripts\AutoIt\Build Auto Installer\avistar.ico", -1) GUISetOnEvent($GUI_EVENT_CLOSE, "Form2Close") $Label1 = GUICtrlCreateLabel("Select the component to install:", 24, 16, 152, 17) $CB_Component = GUICtrlCreateCombo("", 40, 40, 113, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData($CB_Component, "RTME|RTC") $Btn_OK_2 = GUICtrlCreateButton("OK", 40, 88, 49, 25) GUICtrlSetOnEvent($Btn_OK_2, "Btn_OK_2Click") $Btn_Cancel_2 = GUICtrlCreateButton("Cancel", 112, 88, 49, 25) GUICtrlSetOnEvent($Btn_Cancel_2, "ProcessCancel") #EndRegion ### END Koda GUI section ### $Loop = 1 While $Loop Sleep(100) WEnd $NewDir = NewestFolder($BuildFolder) If @error Then ; If NewestFolder() didn't error out, report the newest directory, otherwise, report the error. MsgBox(8240, 'Error', 'No folders in directory') Exit EndIf Exit ; ----------------------------- Functions --------------------------- ; Get the build options provided by the user Func SetBuildOptions() $Branch = GUICtrlRead($CB_Branch) $Product = GUICtrlRead($CB_Product) $Type = GUICtrlRead($CB_Type) $Options = GUICtrlRead($CB_Options) ; Check to see if the user failed to select any options If $Branch == "" Or $Product = "" Or $Type = "" Or $Options = "" Then MsgBox(8208, "Missing Selection!", "Please choose an option from each ComboBox!") Return EndIf GUIDelete($Form1) $Loop = 0 ; If all of the options have been selected, exit the loop If $Product = "Citrix HDX" Then GUISetState(@SW_SHOW, $Form2) $Loop = 1 While $Loop = 1 Sleep(100) WEnd EndIf EndFunc ; The user clicked the Cancel button Func ProcessCancel() $RtnVal = MsgBox(8228, "Cancel Installation?", "Are you sure you want to cancel the installation?") If $RtnVal = 6 Then Exit ; Yes was clicked EndFunc Func Btn_OK_2Click() $Component = GUICtrlRead($CB_Component) If $Component == "" Then MsgBox(8208, "Missing Component!", "Please select a component!") Return EndIf GUISetState(@SW_HIDE, $Form2) $Loop = 0 ; If all of the options have been selected, close the dialog EndFunc INI File: [Config] Branch=Barrayar|Caprica|Trunk Product=C3 Communicator|Citrix HDX|Unified Component=RTME|RTC Type=Debug|Release Options=Install the latest build|Install a specific version|Browse for an installerBuild_Auto_Installer.au3 Link to comment Share on other sites More sharing options...
water Posted June 4, 2012 Share Posted June 4, 2012 Haven't looked into your code but I can suggest a very good reading in the Wiki on how to manage multiple GUIs. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
robinsiebler Posted June 4, 2012 Author Share Posted June 4, 2012 As I said, I read it, but I couldn't figure out how to make it work with my script. I tried several of the things mentioned, but I am obviously doing something wrong because nothing I tried worked. Link to comment Share on other sites More sharing options...
water Posted June 4, 2012 Share Posted June 4, 2012 As you can see from the Wiki there is only one loop in the script. Remove While/Wend from function SetBuildOptions and see if this solves your problem. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
robinsiebler Posted June 4, 2012 Author Share Posted June 4, 2012 Nope. Then the dialog appears, but it doesn't respond and my script moves on to the next step. Link to comment Share on other sites More sharing options...
water Posted June 4, 2012 Share Posted June 4, 2012 I added the following three missing functions to your script and removed the While/Wend and it acts fine on Cancel and OK. Cancel: I get MsgBox "Are you sure you want to cancel the installation?" OK: Function BTN_OK_2Click is called, then function NewestFolder. Func Form1Close() MsgBox(0, "", "Form1Close") EndFunc Func Form2Close() MsgBox(0, "", "Form2Close") EndFunc Func NewestFolder($Param1) MsgBox(0, "", "NewestFolder") EndFunc My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
robinsiebler Posted June 4, 2012 Author Share Posted June 4, 2012 I I added the following three missing functions to your script and removed the While/Wend and it acts fine on Cancel and OK.I don't see how. I did what you said and this is what happens:1. I select the options in the 1st dialog ("Build Auto Installer")2. I click "OK"As soon as I click "OK", the 2nd dialog and the MsgBox from NewestDirectory pop up. Link to comment Share on other sites More sharing options...
robinsiebler Posted June 4, 2012 Author Share Posted June 4, 2012 I moved the below code up into the main body (which I think is kind of sloppy) and now it works. If $Product = "Citrix HDX" Then GUISetState(@SW_SHOW, $Form2) $Loop = 1 While $Loop = 1 Sleep(100) WEnd EndIf Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now