Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Events on 2nd dialog not processed


  • Please log in to reply
7 replies to this topic

#1 robinsiebler

robinsiebler

    Adventurer

  • Active Members
  • PipPip
  • 102 posts

Posted 04 June 2012 - 07:35 AM

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'.

Plain Text         
; 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 installer

Attached Files









#2 water

water

    ?

  • MVPs
  • 14,584 posts

Posted 04 June 2012 - 07:44 AM

Haven't looked into your code but I can suggest a very good reading in the Wiki on how to manage multiple GUIs.

UDFs:
Active Directory (NEW: 2014-02-17 - Version 1.4.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2013-11-10 - Version 0.10.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1) - Download - General Help & Support - Example Scripts
Excel (NEW: 2014-03-22 - Beta 5) - Download - General Help & Support - Example Scripts


#3 robinsiebler

robinsiebler

    Adventurer

  • Active Members
  • PipPip
  • 102 posts

Posted 04 June 2012 - 07:46 AM

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.

#4 water

water

    ?

  • MVPs
  • 14,584 posts

Posted 04 June 2012 - 08:09 AM

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.

UDFs:
Active Directory (NEW: 2014-02-17 - Version 1.4.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2013-11-10 - Version 0.10.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1) - Download - General Help & Support - Example Scripts
Excel (NEW: 2014-03-22 - Beta 5) - Download - General Help & Support - Example Scripts


#5 robinsiebler

robinsiebler

    Adventurer

  • Active Members
  • PipPip
  • 102 posts

Posted 04 June 2012 - 08:22 AM

Nope. Then the dialog appears, but it doesn't respond and my script moves on to the next step.

#6 water

water

    ?

  • MVPs
  • 14,584 posts

Posted 04 June 2012 - 08:31 AM

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

UDFs:
Active Directory (NEW: 2014-02-17 - Version 1.4.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2013-11-10 - Version 0.10.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1) - Download - General Help & Support - Example Scripts
Excel (NEW: 2014-03-22 - Beta 5) - Download - General Help & Support - Example Scripts


#7 robinsiebler

robinsiebler

    Adventurer

  • Active Members
  • PipPip
  • 102 posts

Posted 04 June 2012 - 10:13 AM

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.

#8 robinsiebler

robinsiebler

    Adventurer

  • Active Members
  • PipPip
  • 102 posts

Posted 04 June 2012 - 10:17 AM

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





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users