Rishav Posted September 1, 2009 Share Posted September 1, 2009 (edited) Hi folks,Have a new issue with my GUI.On clicking a certain i create a popup UI with its own set of controls. However, now on clicking any of the controls in this new UI, no event is registered.on clicking a button "Currency Alias" $CurrencyAlias_button, i create a new GUI "Currency Alias". this UI has 2 buttons of its own; Add and remove. However, when i click Add ($CurrencyAlias_Add_button) nothing happens.On the other hand, when i bring up the other popup UI (Additional Dates), I end up getting the event on every iteration of the While loop. Any help?There is only one invocation each of $AdditionalDates_Add_button and $CurrencyAlias_Add_button.expandcollapse popup#cs ######################################################################################################################################################## AutoIt Version: 3.3.1.1 (beta) Author: Rishav Sharan Script Function: GUI to create simple import test cases Please note that I use a GUI Backend data file. This is the temp ini file which saves all the data till a specific new file is created. This is to save the data in case of system failure. If we added the data directly to the grid, in case of accidental closure or power failure, the data will be lost. #ce ######################################################################################################################################################## #cs ---------------------------------------------------------------------------- Includes #ce ---------------------------------------------------------------------------- #include <Array.au3> #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <File.au3> #include <GuiButton.au3> #include <GuiComboBox.au3> #include <GuiConstantsEx.au3> #include <GuiDateTimePicker.au3> #include <GuiImageList.au3> #include <GuiListView.au3> #include <GuiTab.au3> #include <GuiToolTip.au3> #include <WindowsConstants.au3> #cs ---------------------------------------------------------------------------- Program Options #ce ---------------------------------------------------------------------------- #NoTrayIcon Opt("MustDeclareVars", 1) HotKeySet("{F1}", "_AboutScreen") #cs ---------------------------------------------------------------------------- Declarations #ce ---------------------------------------------------------------------------- ; Global declare file attributes Global $d, $szDrive, $szDir, $szFName, $szExt Global $hGUI, $hImage, $hGraphic, $hImage1 ; Global declare temporary variable Global $AboutScreen_GUI = 0 Global $AdditionalDates_gui = 0 ; Declare GUIs Global $MainGUI, $MainImportGUI, $ControlGUI, $MainWelcomeGUI, $AboutScreen_GUI, $MainSetupGUI, $AdditionalDates_gui, $CurrencyAlias_gui ; Declare Module buttons Global $Welcome_Module_button, $Setup_Module_button, $Smoke_Module_button, $Import_Module_button, $System_Module_button, $Summary_Module_button, $Options_Module_button ; Declare constants Dim Const $x1 = 150, $y1 = 10, $x2 = 75, $y2 = 10, $x3 = 10, $y3 = 20 ; Declare temporary variable Dim $GenericTempValue = "temp value" ; Declare fields Dim $TestType_field, $TCName_field, $TCPassNo_field, $CarrierName_field, $ImportFileLocation_field, $RefDefFileLocation_field, $AdditionalDetails_field, $Destnination_field Dim $Rate_field, $DialCode_field, $EffDate_datefield, $ExpDate_datefield, $ServerDetails_field, $UidPass_field, $IncrDate_datefield, $DecrDate_datefield, $Currency_field Dim $CurrencyAlias_name_field, $CurrencyAlias_alias_field ; Declare labels Dim $TCName_label, $TCPassNo_label, $TestType_label, $CarrierName_label, $AboutScreen_label, $RefDefFileLocation_label, $IncrDate_label, $DecrDate_label, $AdditionalDetails_label Dim $Destnination_label, $DialCode_label, $ImportFileLocation_label, $Rate_label, $EffDate_label, $ExpDate_label, $ServerDetails_label, $UidPass_label, $AboutScreen_label Dim $Currency_label, $CurrencyAlias_alias_label, $CurrencyAlias_name_label ; Declare buttons and other elements Dim $AddtoBatch_button, $RemFromGrid_button, $MoveUp_button, $MoveDown_button, $DeleteProfile_button, $GridToFile_button, $RunBatch_button Dim $Tab_TCSuite, $BatchList, $AdditionalDates_button, $AdditionalDates_chkbox, $CurrencyAlias_button, $CurrencyAlias_chkbox, $AdditionalDates_Add_button, $AdditionalDates_Rem_button Dim $AdditionalDates_datefield, $AdditionalDates_grid, $CurrencyAlias_Add_button, $CurrencyAlias_Rem_button, $CurrencyAlias_grid ; Declare grid columns Dim $Grid_serial_col, $Grid_sequence_col, $Grid_Timestamp_col, $Grid_Status_col, $Grid_TimeTaken_col, $Grid_TCName_col, $Grid_PassNo_col, $Grid_Carrier_col, $Grid_CurAlias_col Dim $Grid_TestType_col, $Grid_Details_col, $Grid_ServerDetails_col, $Grid_AutoExpire_col, $Grid_IncrDate_col, $Grid_DecrDate_col, $Grid_DestName_col, $Grid_DialCode_col Dim $Grid_UidPass_col, $Grid_Rate_col, $Grid_EffectievDate_col, $Grid_ExpiryDate_col, $Grid_RSFile_col, $Grid_RefFile_col, $Grid_Currency_col, $Grid_AddDates_col ; Declare data variables Dim $TestType_data, $SectionNumber_data, $Timestamp_data, $TestCaseStatus_data, $OverallResult_data, $TCName_data, $TCPassNo_data, $CarrierName_data, $AdditionalDetails_data Dim $ServerDetails_data, $IncrDate_data, $DecrDate_data, $Destnination_data, $DialCode_data, $UidPass_data, $Rate_data, $EffDate_data, $ImportFileLocation_data, $Currency_data Dim $RefDefFileLocation_data, $AutoExpire_data, $Grid_All_listdata, $EffDate_data, $ExpDate_data, $IncrDate_day, $IncrDate_month, $IncrDate_year Dim $DecrDate_day, $DecrDate_month, $DecrDate_year ; Declare handles Dim $EffDate_handle, $ExpDate_handle, $IncrDate_handle, $DecrDate_handle, $BatchList_handle, $AdditionalDates_handle ; Display arrays Dim $ProfilesIniFileList_array, $ImportIniFileList_array, $tmp_array ; Declare assets Dim $WelcomeModule_pic ; Declare Paths Dim $IconsFolder, $ProfilesINI, $Cache_Filelist_file, $Cache_GridStatus_file, $Cache_Main_file, $Cache_AddDates_file ; Declare misc variables Dim $ProfilesINI_NewName, $ProfilesINI_OnlyFileName, $ImportCombo_Insert_Name, $Grid_listdata_sections, $SelectedRow, $Ini_Section_delete Dim $Selected_section, $Above_section, $Below_section, $Tab_Insert_Name, $RefDefCombo_Insert_Name, $Tab_Name, $ClickedModule_button ; Declare indices Dim $msg, $current, $iIndex, $temp, $tDate, $a, $b, $c, $d, $e, $msg_output, $hWnd, $i, $temp2, $temp3, $hImage #cs ---------------------------------------------------------------------------- Paths #ce ---------------------------------------------------------------------------- $Cache_Main_file = @ScriptDir & "\System\Cache\Cache Main.ini" $Cache_Filelist_file = @ScriptDir & "\System\Cache\Cache Filelist.ini" $Cache_GridStatus_file = @ScriptDir & "\System\Cache\Cache Grid Status.ini" $Cache_AddDates_file = @ScriptDir & "\System\Cache\Cache Additional Dates Grid.ini" $IconsFolder = @ScriptDir & "\System\Icons\" #cs ######################################################################################################################################################## Main GUI creation #ce ######################################################################################################################################################## $MainImportGUI = GUICreate("Automata v0.1 alpha", 1250, 900, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_SYSMENU, $WS_CAPTION, $WS_POPUPWINDOW, $WS_GROUP)) GUISetIcon(@SystemDir & "\system\Donkey.ico", 0) GUISetBkColor(0xFFFFFF) ; MODULE SELECTOR. LATER NEED TO MOVE IT TO A MASTER GUI $Welcome_Module_button = GUICtrlCreateButton("Welcome Module", $x3, $y3, 130, 100, $WS_BORDER) $Setup_Module_button = GUICtrlCreateButton("Setup Module", $x3, $y3 + 100, 130, 100, BitOR($BS_ICON, $WS_BORDER)) $Smoke_Module_button = GUICtrlCreateButton("Smoke Module", $x3, $y3 + 200, 130, 100, BitOR($BS_ICON, $WS_BORDER)) $Import_Module_button = GUICtrlCreateButton("Import Module", $x3, $y3 + 300, 130, 100, BitOR($BS_ICON, $WS_BORDER)) GUICtrlSetFont($Import_Module_button, 11, 800) GUICtrlSetBkColor($Import_Module_button, 0xFFFFFF) $System_Module_button = GUICtrlCreateButton("System Module", $x3, $y3 + 400, 130, 100, BitOR($BS_ICON, $WS_BORDER)) $Summary_Module_button = GUICtrlCreateButton("Summary Module", $x3, $y3 + 500, 130, 100, BitOR($BS_ICON, $WS_BORDER)) $Options_Module_button = GUICtrlCreateButton("Options Module", $x3, $y3 + 600, 130, 100, BitOR($BS_ICON, $WS_BORDER)) ; DETAILS FIELDS $TCName_label = GUICtrlCreateLabel("Test Case Name", $x1 + 10, $y1 + 23, 90, 15) $TCName_field = GUICtrlCreateCombo("", $x1 + 110, $y1 + 23, 170, 20, $ES_UPPERCASE) $TCPassNo_label = GUICtrlCreateLabel("Pass Number", $x1 + 320, $y1 + 23, 90, 15) $TCPassNo_field = GUICtrlCreateInput("1", $x1 + 420, $y1 + 23, 170, 20, $ES_NUMBER) $TestType_label = GUICtrlCreateLabel("Test Type", $x1 + 630, $y1 + 23, 90, 15) $TestType_field = GUICtrlCreateCombo("", $x1 + 730, $y1 + 23, 170, 20, $CBS_DROPDOWNLIST) GUICtrlSetData($TestType_field, "Import Rates to Pending|Import Rates to Active|Edit Carrier Rates|Add Analysis Stage|Run SQL File|Run Win Batch File", "Import Rates to Pending") ; TC SUITE TABS $Tab_TCSuite = _GUICtrlTab_Create($MainImportGUI, $x1, $y1 + 242, 1090, 650) _RefreshTabBar() ; SET PROFILES INI BASED ON THE TAB SELECTED $current = _GUICtrlTab_GetCurSel($Tab_TCSuite) $Tab_Name = _GUICtrlTab_GetItemText($Tab_TCSuite, $current) $ProfilesINI = @ScriptDir & "\Profiles\" & $Tab_Name & ".ini" ; GROUP FOR BUTTONS GUICtrlCreateGroup("", $x1 + 925, $y1, 160, 230) ; BUTTONS $AddtoBatch_button = GUICtrlCreateButton("Add to Grid", $x1 + 940, $y1 + 10, 60, 50, $BS_ICON) GUICtrlSetImage($AddtoBatch_button, $IconsFolder & "\Add_to_Grid.ico") GUICtrlSetTip($AddtoBatch_button, "Add to Grid", "", 1, 1) $RemFromGrid_button = GUICtrlCreateButton("Remove from Grid", $x1 + 1010, $y1 + 10, 60, 50, $BS_ICON) GUICtrlSetImage($RemFromGrid_button, $IconsFolder & "\Remove_from_Grid.ico") GUICtrlSetTip($RemFromGrid_button, "Remove from Grid", "", 1, 1) $MoveUp_button = GUICtrlCreateButton("Move up Item", $x1 + 940, $y1 + 65, 60, 50, $BS_ICON) GUICtrlSetImage($MoveUp_button, $IconsFolder & "\Move_Up.ico") GUICtrlSetTip($MoveUp_button, "Move up Item", "", 1, 1) $MoveDown_button = GUICtrlCreateButton("Move Down Item", $x1 + 1010, $y1 + 65, 60, 50, $BS_ICON) GUICtrlSetImage($MoveDown_button, $IconsFolder & "\Move_Down.ico") GUICtrlSetTip($MoveDown_button, "Move Down Item", "", 1, 1) $DeleteProfile_button = GUICtrlCreateButton("Save Grid to file", $x1 + 1010, $y1 + 120, 60, 50, $BS_ICON) GUICtrlSetImage($DeleteProfile_button, $IconsFolder & "\Delete_Profile.ico") GUICtrlSetTip($DeleteProfile_button, "Delete Profile", "", 1, 1) $GridToFile_button = GUICtrlCreateButton("Add Separator", $x1 + 940, $y1 + 120, 60, 50, $BS_ICON) GUICtrlSetImage($GridToFile_button, $IconsFolder & "\Save_to_File.ico") GUICtrlSetTip($GridToFile_button, "Save Grid to file", "", 1, 1) $RunBatch_button = GUICtrlCreateButton("Run Batch", $x1 + 940, $y1 + 175, 130, 45, BitOR($BS_ICON, $BS_DEFPUSHBUTTON, $WS_THICKFRAME)) GUICtrlSetImage($RunBatch_button, $IconsFolder & "\Run_Batch.ico") GUICtrlSetTip($RunBatch_button, "Run Batch", "", 1, 1) ; DISABLE ALL EXTRA BUTTONS CURRENTLY GUICtrlSetState($Import_Module_button, $GUI_DISABLE) GUICtrlSetState($Welcome_Module_button, $GUI_HIDE) GUICtrlSetState($Setup_Module_button, $GUI_HIDE) GUICtrlSetState($Smoke_Module_button, $GUI_HIDE) GUICtrlSetState($System_Module_button, $GUI_HIDE) GUICtrlSetState($Summary_Module_button, $GUI_HIDE) GUICtrlSetState($Options_Module_button, $GUI_HIDE) ; LIST VIEW $BatchList = GUICtrlCreateListView("", $x1 + 5, $y1 + 270, 1075, 620, BitOR(-1, $LVS_NOSORTHEADER, $WS_VSCROLL), BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_HEADERDRAGDROP, $LVS_EX_SUBITEMIMAGES, $LVS_EX_DOUBLEBUFFER)) $BatchList_handle = GUICtrlGetHandle($BatchList) $Grid_serial_col = _GUICtrlListView_AddColumn($BatchList, "Serial No.") $Grid_sequence_col = _GUICtrlListView_AddColumn($BatchList, "Sequence") $Grid_Timestamp_col = _GUICtrlListView_AddColumn($BatchList, "Timestamp", $LVSCW_AUTOSIZE_USEHEADER) $Grid_Status_col = _GUICtrlListView_AddColumn($BatchList, "Test Case Status", $LVSCW_AUTOSIZE_USEHEADER) $Grid_TimeTaken_col = _GUICtrlListView_AddColumn($BatchList, "Time Taken", $LVSCW_AUTOSIZE_USEHEADER) $Grid_TCName_col = _GUICtrlListView_AddColumn($BatchList, "Test Case Name", $LVSCW_AUTOSIZE_USEHEADER) $Grid_PassNo_col = _GUICtrlListView_AddColumn($BatchList, "Pass No.", $LVSCW_AUTOSIZE_USEHEADER) $Grid_Carrier_col = _GUICtrlListView_AddColumn($BatchList, "Carrier Name", $LVSCW_AUTOSIZE_USEHEADER) $Grid_TestType_col = _GUICtrlListView_AddColumn($BatchList, "Test Type", $LVSCW_AUTOSIZE_USEHEADER) $Grid_Details_col = _GUICtrlListView_AddColumn($BatchList, "Details", $LVSCW_AUTOSIZE_USEHEADER) $Grid_Currency_col = _GUICtrlListView_AddColumn($BatchList, "Currency", $LVSCW_AUTOSIZE_USEHEADER) $Grid_RSFile_col = _GUICtrlListView_AddColumn($BatchList, "Template File", $LVSCW_AUTOSIZE) $Grid_IncrDate_col = _GUICtrlListView_AddColumn($BatchList, "Increase Date", $LVSCW_AUTOSIZE_USEHEADER) $Grid_DecrDate_col = _GUICtrlListView_AddColumn($BatchList, "Decrease Date", $LVSCW_AUTOSIZE_USEHEADER) $Grid_AddDates_col = _GUICtrlListView_AddColumn($BatchList, "Use Additional Dates", $LVSCW_AUTOSIZE_USEHEADER) $Grid_CurAlias_col = _GUICtrlListView_AddColumn($BatchList, "Use Currency Alias", $LVSCW_AUTOSIZE_USEHEADER) $Grid_DestName_col = _GUICtrlListView_AddColumn($BatchList, "Destination", $LVSCW_AUTOSIZE_USEHEADER) $Grid_DialCode_col = _GUICtrlListView_AddColumn($BatchList, "Dial Code", $LVSCW_AUTOSIZE_USEHEADER) $Grid_Rate_col = _GUICtrlListView_AddColumn($BatchList, "Rate", $LVSCW_AUTOSIZE_USEHEADER) $Grid_EffectievDate_col = _GUICtrlListView_AddColumn($BatchList, "Effective Date", $LVSCW_AUTOSIZE_USEHEADER) $Grid_ExpiryDate_col = _GUICtrlListView_AddColumn($BatchList, "Expiry Date", $LVSCW_AUTOSIZE_USEHEADER) $Grid_ServerDetails_col = _GUICtrlListView_AddColumn($BatchList, "Server Details", $LVSCW_AUTOSIZE_USEHEADER) $Grid_UidPass_col = _GUICtrlListView_AddColumn($BatchList, "UserId/Password", $LVSCW_AUTOSIZE_USEHEADER) GUISetState() #cs ######################################################################################################################################################## Child GUI creation. This window resides on main GUI and changes accroding to changing options. #ce ######################################################################################################################################################## ; CREATE A CHILD GUI TO THE MAIN GUI WHICH WILL HOLD ALL THE DYNAMIC CONTROLS $ControlGUI = GUICreate("", 1090, 230, $x2, $y2, $WS_CHILD, -1, $MainImportGUI) GUISetBkColor(0xFFFFFF) GUICtrlCreateGroup("Please set the Test Case parameters", $x2, 0, 910, 230) ; DETAILS FIELDS $CarrierName_label = GUICtrlCreateLabel("Carrier Name", $x2 + 10, $y2 + 45, 90, 15) $CarrierName_field = GUICtrlCreateInput("", $x2 + 110, $y2 + 45, 170, 20, $ES_UPPERCASE) $ImportFileLocation_label = GUICtrlCreateLabel("Import File", $x2 + 10, $y2 + 80, 90, 15) $ImportFileLocation_field = GUICtrlCreateCombo("", $x2 + 110, $y2 + 80, 170, 20, $CBS_DROPDOWNLIST) $ImportIniFileList_array = _FileListToArray(@ScriptDir & "\Import Files\", "*.ini", 1) ; Add Entries to the Import field If @error = 0 Then For $e = 1 To $ImportIniFileList_array[0] $ImportCombo_Insert_Name = StringTrimRight($ImportIniFileList_array[$e], 4) _GUICtrlComboBox_InsertString($ImportFileLocation_field, $ImportCombo_Insert_Name) Next EndIf ; Currency field $Currency_label = GUICtrlCreateLabel("Import Currency", $x2 + 630, $y2 + 45, 90, 15) $Currency_field = GUICtrlCreateInput("", $x2 + 730, $y2 + 45, 170, 20, $ES_UPPERCASE) GUICtrlSetLimit($Currency_field, 3) ; DATES $IncrDate_label = GUICtrlCreateLabel("Increase Date", $x2 + 320, $y2 + 80, 90, 20) $IncrDate_datefield = GUICtrlCreateDate("", $x2 + 420, $y2 + 80, 170, 20) $IncrDate_handle = GUICtrlGetHandle($IncrDate_datefield) _GUICtrlDTP_SetFormat($IncrDate_handle, "ddd, dd/MMM/yy") $DecrDate_label = GUICtrlCreateLabel("Decrease Date", $x2 + 630, $y2 + 80, 90, 20) $DecrDate_datefield = GUICtrlCreateDate("", $x2 + 730, $y2 + 80, 170, 20) $DecrDate_handle = GUICtrlGetHandle($DecrDate_datefield) _GUICtrlDTP_SetFormat($DecrDate_handle, "ddd, dd/MMM/yy") ; Create controls for the Currency Alias popup GUI $CurrencyAlias_chkbox = GUICtrlCreateCheckbox("", $x2 + 80, $y2 + 115, 20, 20) $CurrencyAlias_button = GUICtrlCreateButton("Currency Alias", $x2 + 110, $y2 + 115, 170, 25) ; Create controls for the popup Additional Dates GUI $AdditionalDates_chkbox = GUICtrlCreateCheckbox("", $x2 + 390, $y2 + 115, 20, 20) $AdditionalDates_button = GUICtrlCreateButton("Additional Dates", $x2 + 420, $y2 + 115, 170, 25) GUISetState() _RefreshGridData() #cs ######################################################################################################################################################## Capture and execute all events and associated operations. #ce ######################################################################################################################################################## ; Capture and execute all button clicks While 1 $msg = GUIGetMsg(1) ConsoleWrite("###############################" & @CRLF & $msg[0] & @CRLF & $msg[1] & @CRLF & $msg[2] & @CRLF & "###############################") Switch $msg[0] #cs ######################################################################################################################################################## Capture and execute all combo option changes. Create or destroy the dynamic child gui based on these options #ce ######################################################################################################################################################## Case $TestType_field $TestType_data = ControlGetText("Automata v0.1 alpha", "Test Type", $TestType_field) Switch $TestType_data #cs ---------------------------------------------------------------------------- Capture and handle option change "Import Rates to Pending" #ce ---------------------------------------------------------------------------- Case "Import Rates to Pending" GUIDelete($ControlGUI) ; CREATE A CHILD GUI TO THE MAIN GUI WHICH WILL HOLD ALL THE DYNAMIC CONTROLS $ControlGUI = GUICreate("", 1090, 230, $x2, $y2, $WS_CHILD, -1, $MainImportGUI) GUISetBkColor(0xFFFFFF) GUICtrlCreateGroup("Please set the Test Case parameters", $x2, 0, 910, 230) ; DETAILS FIELDS $CarrierName_label = GUICtrlCreateLabel("Carrier Name", $x2 + 10, $y2 + 45, 90, 15) $CarrierName_field = GUICtrlCreateInput("", $x2 + 110, $y2 + 45, 170, 20, $ES_UPPERCASE) ; Currency field $Currency_label = GUICtrlCreateLabel("Import Currency", $x2 + 630, $y2 + 45, 90, 15) $Currency_field = GUICtrlCreateInput("", $x2 + 730, $y2 + 45, 170, 20, $ES_UPPERCASE) GUICtrlSetLimit($Currency_field, 3) $ImportFileLocation_label = GUICtrlCreateLabel("Import File", $x2 + 10, $y2 + 80, 90, 15) $ImportFileLocation_field = GUICtrlCreateCombo("", $x2 + 110, $y2 + 80, 170, 20, $CBS_DROPDOWNLIST) ; GET ALL INI FILES IN THE IMPORT FOLDER IN AN ARRAY $ImportIniFileList_array = _FileListToArray(@ScriptDir & "\Import Files\", "*.ini", 1) ; Add Entries to the Import field If @error = 0 Then For $e = 1 To $ImportIniFileList_array[0] $ImportCombo_Insert_Name = StringTrimRight($ImportIniFileList_array[$e], 4) _GUICtrlComboBox_InsertString($ImportFileLocation_field, $ImportCombo_Insert_Name) Next EndIf ; DATES $IncrDate_label = GUICtrlCreateLabel("Increase Date", $x2 + 320, $y2 + 80, 90, 20) $IncrDate_datefield = GUICtrlCreateDate("", $x2 + 420, $y2 + 80, 170, 20) $IncrDate_handle = GUICtrlGetHandle($IncrDate_datefield) _GUICtrlDTP_SetFormat($IncrDate_handle, "ddd, dd/MMM/yy") $DecrDate_label = GUICtrlCreateLabel("Decrease Date", $x2 + 630, $y2 + 80, 90, 20) $DecrDate_datefield = GUICtrlCreateDate("", $x2 + 730, $y2 + 80, 170, 20) $DecrDate_handle = GUICtrlGetHandle($DecrDate_datefield) _GUICtrlDTP_SetFormat($DecrDate_handle, "ddd, dd/MMM/yy") ; Create controls for the Currency Alias popup GUI $CurrencyAlias_chkbox = GUICtrlCreateCheckbox("", $x2 + 80, $y2 + 115, 20, 20) $CurrencyAlias_button = GUICtrlCreateButton("Currency Alias", $x2 + 110, $y2 + 115, 170, 25) GUISetState() #cs ---------------------------------------------------------------------------- Capture and handle option change "Import Rates to Active" #ce ---------------------------------------------------------------------------- Case "Import Rates to Active" GUIDelete($ControlGUI) ; CREATE A CHILD GUI TO THE MAIN GUI WHICH WILL HOLD ALL THE DYNAMIC CONTROLS $ControlGUI = GUICreate("", 1090, 230, $x2, $y2, $WS_CHILD, -1, $MainImportGUI) GUISetBkColor(0xFFFFFF) GUICtrlCreateGroup("Please set the Test Case parameters", $x2, 0, 910, 230) ; DETAILS FIELDS $CarrierName_label = GUICtrlCreateLabel("Carrier Name", $x2 + 10, $y2 + 45, 90, 15) $CarrierName_field = GUICtrlCreateInput("", $x2 + 110, $y2 + 45, 170, 20, $ES_UPPERCASE) $AdditionalDetails_label = GUICtrlCreateLabel("Additional Details", $x2 + 320, $y2 + 45, 90, 15) $AdditionalDetails_field = GUICtrlCreateCombo("", $x2 + 420, $y2 + 45, 170, 20, $CBS_DROPDOWNLIST) GUICtrlSetData($AdditionalDetails_field, "Don't Autoexpire Old Data|Autoexpire Old Data", "Don't Autoexpire Old Data") ; Currency field $Currency_label = GUICtrlCreateLabel("Import Currency", $x2 + 630, $y2 + 45, 90, 15) $Currency_field = GUICtrlCreateInput("", $x2 + 730, $y2 + 45, 170, 20, $ES_UPPERCASE) GUICtrlSetLimit($Currency_field, 3) $ImportFileLocation_label = GUICtrlCreateLabel("Import File", $x2 + 10, $y2 + 80, 90, 15) $ImportFileLocation_field = GUICtrlCreateCombo("", $x2 + 110, $y2 + 80, 170, 20, $CBS_DROPDOWNLIST) ; ADD FILES FROM IMPORT FOLDER TO ARRAY $ImportIniFileList_array = _FileListToArray(@ScriptDir & "\Import Files\", "*.ini", 1) ; Add Entries to the Import field If @error = 0 Then For $e = 1 To $ImportIniFileList_array[0] $ImportCombo_Insert_Name = StringTrimRight($ImportIniFileList_array[$e], 4) _GUICtrlComboBox_InsertString($ImportFileLocation_field, $ImportCombo_Insert_Name) Next EndIf ; DATES $IncrDate_label = GUICtrlCreateLabel("Increase Date", $x2 + 320, $y2 + 80, 90, 20) $IncrDate_datefield = GUICtrlCreateDate("", $x2 + 420, $y2 + 80, 170, 20) $IncrDate_handle = GUICtrlGetHandle($IncrDate_datefield) _GUICtrlDTP_SetFormat($IncrDate_handle, "ddd, dd/MMM/yy") $DecrDate_label = GUICtrlCreateLabel("Decrease Date", $x2 + 630, $y2 + 80, 90, 20) $DecrDate_datefield = GUICtrlCreateDate("", $x2 + 730, $y2 + 80, 170, 20) $DecrDate_handle = GUICtrlGetHandle($DecrDate_datefield) _GUICtrlDTP_SetFormat($DecrDate_handle, "ddd, dd/MMM/yy") ; Create controls for the popup Additional Dates GUI $AdditionalDates_chkbox = GUICtrlCreateCheckbox("", $x2 + 390, $y2 + 115, 20, 20) $AdditionalDates_button = GUICtrlCreateButton("Additional Dates", $x2 + 420, $y2 + 115, 170, 25) ; Create controls for the Currency Alias popup GUI $CurrencyAlias_chkbox = GUICtrlCreateCheckbox("", $x2 + 80, $y2 + 115, 20, 20) $CurrencyAlias_button = GUICtrlCreateButton("Currency Alias", $x2 + 110, $y2 + 115, 170, 25) GUISetState() #cs ---------------------------------------------------------------------------- Capture and handle option change "Edit Carrier Rates" #ce ---------------------------------------------------------------------------- Case "Edit Carrier Rates" GUIDelete($ControlGUI) ; CREATE A CHILD GUI TO THE MAIN GUI WHICH WILL HOLD ALL THE DYNAMIC CONTROLS $ControlGUI = GUICreate("", 1090, 230, $x2, $y2, $WS_CHILD, -1, $MainImportGUI) GUISetBkColor(0xFFFFFF) GUICtrlCreateGroup("Please set the Test Case parameters", $x2, 0, 910, 230) ; DETAILS FIELDS $CarrierName_label = GUICtrlCreateLabel("Carrier Name", $x2 + 10, $y2 + 45, 90, 15) $CarrierName_field = GUICtrlCreateInput("", $x2 + 110, $y2 + 45, 170, 20, $ES_UPPERCASE) $AdditionalDetails_label = GUICtrlCreateLabel("Additional Details", $x2 + 320, $y2 + 45, 90, 15) $AdditionalDetails_field = GUICtrlCreateCombo("", $x2 + 420, $y2 + 45, 170, 20, $CBS_DROPDOWNLIST) GUICtrlSetData($AdditionalDetails_field, "Refresh Grid|Edit Entry|Delete Entry|Clear All", "Refresh Grid") ; DETAILS FIELDS $Destnination_label = GUICtrlCreateLabel("Destination Name", $x2 + 10, $y2 + 110, 90, 15) $Destnination_field = GUICtrlCreateInput("", $x2 + 110, $y2 + 110, 170, 20) $DialCode_label = GUICtrlCreateLabel("Dial Code", $x2 + 320, $y2 + 110, 90, 15) $DialCode_field = GUICtrlCreateInput("", $x2 + 420, $y2 + 110, 170, 20, $ES_NUMBER) $Rate_label = GUICtrlCreateLabel("Rate", $x2 + 630, $y2 + 110, 90, 15) $Rate_field = GUICtrlCreateInput("", $x2 + 730, $y2 + 110, 170, 20, $ES_NUMBER) ; CHECKBOXED DATE $tDate = 0 $EffDate_label = GUICtrlCreateLabel("Use Effective Date", $x2 + 320, $y2 + 140, 90, 20) $EffDate_datefield = GUICtrlCreateDate("", $x2 + 420, $y2 + 140, 170, 20, BitOR($DTS_SHOWNONE, $DTS_LONGDATEFORMAT)) $EffDate_handle = GUICtrlGetHandle($EffDate_datefield) _GUICtrlDTP_SetFormat($EffDate_handle, "ddd, dd/MMM/yy") _GUICtrlDTP_SetSystemTimeEx($EffDate_handle, $tDate, True) $ExpDate_label = GUICtrlCreateLabel("Use Expiry Date", $x2 + 630, $y2 + 140, 90, 20) $ExpDate_datefield = GUICtrlCreateDate("", $x2 + 730, $y2 + 140, 170, 20, BitOR($DTS_SHOWNONE, $DTS_LONGDATEFORMAT)) $ExpDate_handle = GUICtrlGetHandle($ExpDate_datefield) _GUICtrlDTP_SetFormat($ExpDate_handle, "ddd, dd/MMM/yy") _GUICtrlDTP_SetSystemTimeEx($ExpDate_handle, $tDate, True) GUISetState() MsgBox(0, "How did you end up here?", "Nothing in here. Go away.") ;RESET THE TEST TYPE TO INITIAL CHOICE ControlSend("Automata v0.1 alpha", "Test Type", $TestType_field, "i") #cs ---------------------------------------------------------------------------- Capture and handle option change "Add Analysis Stage" #ce ---------------------------------------------------------------------------- Case "Add Analysis Stage" GUIDelete($ControlGUI) ; CREATE A CHILD GUI TO THE MAIN GUI WHICH WILL HOLD ALL THE DYNAMIC CONTROLS $ControlGUI = GUICreate("", 1090, 230, $x2, $y2, $WS_CHILD, -1, $MainImportGUI) GUISetBkColor(0xFFFFFF) GUICtrlCreateGroup("Please set the Test Case parameters", $x2, 0, 910, 230) $AdditionalDetails_label = GUICtrlCreateLabel("Additional Details", $x2 + 320, $y2 + 45, 90, 15) $AdditionalDetails_field = GUICtrlCreateCombo("", $x2 + 420, $y2 + 45, 170, 20, $CBS_DROPDOWNLIST) GUICtrlSetData($AdditionalDetails_field, "Run All Scripts|Run Script A001|Run Script A002|Run Script A003|Run Script A004|", "Run All Scripts") GUISetState() #cs ---------------------------------------------------------------------------- Capture and handle option change "Run SQL File" #ce ---------------------------------------------------------------------------- Case "Run SQL File" GUIDelete($ControlGUI) ; CREATE A CHILD GUI TO THE MAIN GUI WHICH WILL HOLD ALL THE DYNAMIC CONTROLS $ControlGUI = GUICreate("", 1090, 230, $x2, $y2, $WS_CHILD, -1, $MainImportGUI) GUISetBkColor(0xFFFFFF) GUICtrlCreateGroup("Please set the Test Case parameters", $x2, 0, 910, 230) $ServerDetails_label = GUICtrlCreateLabel("Server Details Name", $x2 + 10, $y2 + 170, 90, 15) $ServerDetails_field = GUICtrlCreateInput("", $x2 + 110, $y2 + 170, 170, 20) $UidPass_label = GUICtrlCreateLabel("User Id/Password", $x2 + 320, $y2 + 170, 90, 15) $UidPass_field = GUICtrlCreateInput("", $x2 + 420, $y2 + 170, 170, 20) GUISetState() MsgBox(0, "How did you end up here?", "Nothing in here. Go away.") ;RESET THE TEST TYPE TO INITIAL CHOICE ControlSend("Automata v0.1 alpha", "Test Type", $TestType_field, "i") #cs ---------------------------------------------------------------------------- Capture and handle option change "Run Win Batch File" #ce ---------------------------------------------------------------------------- Case "Run Win Batch File" GUIDelete($ControlGUI) ; CREATE A CHILD GUI TO THE MAIN GUI WHICH WILL HOLD ALL THE DYNAMIC CONTROLS $ControlGUI = GUICreate("", 1090, 230, $x2, $y2, $WS_CHILD, -1, $MainImportGUI) GUISetBkColor(0xFFFFFF) GUICtrlCreateGroup("Please set the Test Case parameters", $x2, 0, 910, 230) $ServerDetails_label = GUICtrlCreateLabel("Server Details Name", $x2 + 10, $y2 + 170, 90, 15) $ServerDetails_field = GUICtrlCreateInput("", $x2 + 110, $y2 + 170, 170, 20) $UidPass_label = GUICtrlCreateLabel("User Id/Password", $x2 + 320, $y2 + 170, 90, 15) $UidPass_field = GUICtrlCreateInput("", $x2 + 420, $y2 + 170, 170, 20) GUISetState() MsgBox(0, "How did you end up here?", "Nothing in here. Go away.") ;RESET THE TEST TYPE TO INITIAL CHOICE ControlSend("Automata v0.1 alpha", "Test Type", $TestType_field, "i") EndSwitch #cs ######################################################################################################################################################## Create the Currency Alias and Additional Dates GUIs on corresponding events #ce ######################################################################################################################################################## #cs ---------------------------------------------------------------------------- Capture $AdditionalDates events and create popup GUI #ce ---------------------------------------------------------------------------- Case $AdditionalDates_button If $msg[1] = $ControlGUI Then SoundPlay(@WindowsDir & "\media\Windows XP Pop-up Blocked.wav") _AdditionDatesScreen() EndIf #cs ---------------------------------------------------------------------------- Capture and handle events for Additional Rates screen #ce ---------------------------------------------------------------------------- Case $AdditionalDates_Add_button If $msg[1] = $AdditionalDates_gui and $msg[2] = $AdditionalDates_Add_button Then ;~ MsgBox(0, "$AdditionalDates_Add_button pressed!", $msg[0] & @CRLF & $msg[1] & @CRLF & $msg[2]) EndIf #cs ---------------------------------------------------------------------------- Clear cache on event occurance for Additional Rates screen #ce ---------------------------------------------------------------------------- #cs ---------------------------------------------------------------------------- Capture $CurrencyAlias events and create popup GUI #ce ---------------------------------------------------------------------------- Case $CurrencyAlias_button If $msg[1] = $ControlGUI Then SoundPlay(@WindowsDir & "\media\Windows XP Pop-up Blocked.wav") _CurrencyAliasScreen() EndIf #cs ---------------------------------------------------------------------------- Capture and handle events for Currency Aliases screen #ce ---------------------------------------------------------------------------- ; clear cache everytime main gui closed or tc added to profile or checkbox cleared Case $CurrencyAlias_Add_button If $msg[1] = $CurrencyAlias_gui And $msg[2] = $CurrencyAlias_Add_button Then SoundPlay(@WindowsDir & "\media\Windows XP Pop-up Blocked.wav") MsgBox(0, "$CurrencyAlias_Add_button pressed!", $msg[0] & @CRLF & $msg[1] & @CRLF & $msg[2]) EndIf #cs ---------------------------------------------------------------------------- Clear cache on event occurance for Additional Rates screen #ce ---------------------------------------------------------------------------- #cs ######################################################################################################################################################## Capture and execute all Button Presses. #ce ######################################################################################################################################################## #cs ---------------------------------------------------------------------------- Capture and handle the button press for $AddtoBatch_button #ce ---------------------------------------------------------------------------- Case $AddtoBatch_button SoundPlay(@WindowsDir & "\media\Windows XP Pop-up Blocked.wav") $Grid_listdata_sections = IniReadSectionNames($ProfilesINI) If @error = 1 Then $SectionNumber_data = 1 Else $SectionNumber_data = $Grid_listdata_sections[0] + 1 EndIf IniWriteSection($ProfilesINI, $SectionNumber_data, "") $TCName_data = ControlGetText("Automata v0.1 alpha", "Test Case Name", $TCName_field) IniWrite($ProfilesINI, $SectionNumber_data, "TEST CASE NAME", $TCName_data) $TCPassNo_data = ControlGetText("Automata v0.1 alpha", "Pass Number", $TCPassNo_field) IniWrite($ProfilesINI, $SectionNumber_data, "PASS NUMBER", $TCPassNo_data) $CarrierName_data = ControlGetText("Automata v0.1 alpha", "Carrier Name", $CarrierName_field) IniWrite($ProfilesINI, $SectionNumber_data, "CARRIER NAME", $CarrierName_data) $TestType_data = ControlGetText("Automata v0.1 alpha", "Test Type", $TestType_field) IniWrite($ProfilesINI, $SectionNumber_data, "TEST TYPE", $TestType_data) $AdditionalDetails_data = ControlGetText("Automata v0.1 alpha", "Additional Details", $AdditionalDetails_field) IniWrite($ProfilesINI, $SectionNumber_data, "DETAILS", $AdditionalDetails_data) ; Set and save Currency option $Currency_data = ControlGetText("Automata v0.1 alpha", "Currency", $Currency_field) IniWrite($ProfilesINI, $SectionNumber_data, "CURRENCY", $Currency_data) ; Get Increase Date from DTP. Break into components and then save $hWnd = ControlGetHandle("Automata v0.1 alpha", "Increase Date", $IncrDate_datefield) $tmp_array = _GUICtrlDTP_GetSystemTime($hWnd) $IncrDate_day = $tmp_array[2] $IncrDate_month = $tmp_array[1] $IncrDate_year = $tmp_array[0] IniWrite($ProfilesINI, $SectionNumber_data, "INCREASE DATE MONTH", $IncrDate_month) IniWrite($ProfilesINI, $SectionNumber_data, "INCREASE DATE DAY", $IncrDate_day) IniWrite($ProfilesINI, $SectionNumber_data, "INCREASE DATE YEAR", $IncrDate_year) ; Get Decrease Date from DTP. Break into components and then save $hWnd = ControlGetHandle("Automata v0.1 alpha", "Decrease Date", $DecrDate_datefield) $tmp_array = _GUICtrlDTP_GetSystemTime($hWnd) $DecrDate_day = $tmp_array[2] $DecrDate_month = $tmp_array[1] $DecrDate_year = $tmp_array[0] IniWrite($ProfilesINI, $SectionNumber_data, "DECREASE DATE MONTH", $DecrDate_month) IniWrite($ProfilesINI, $SectionNumber_data, "DECREASE DATE DAY", $DecrDate_day) IniWrite($ProfilesINI, $SectionNumber_data, "DECREASE DATE YEAR", $DecrDate_year) ; Use additional Dates IniWrite($ProfilesINI, $SectionNumber_data, "USE ADDITIONAL DATES", "0") ; Additional Dates IniWrite($ProfilesINI, $SectionNumber_data, "ADDITIONAL DATES", "") ; Use Currency Aliases IniWrite($ProfilesINI, $SectionNumber_data, "USE CURRENCY ALIASES", "0") ; Currency Aliases IniWrite($ProfilesINI, $SectionNumber_data, "CURRENCY ALIASES", "") $ImportFileLocation_data = ControlGetText("Automata v0.1 alpha", "Import File", $ImportFileLocation_field) IniWrite($ProfilesINI, $SectionNumber_data, "IMPORT FILE", $ImportFileLocation_data) $Destnination_data = ControlGetText("Automata v0.1 alpha", "Destination Name", $Destnination_field) IniWrite($ProfilesINI, $SectionNumber_data, "DESTINATION", $Destnination_data) $DialCode_data = ControlGetText("Automata v0.1 alpha", "Dialcode", $DialCode_field) IniWrite($ProfilesINI, $SectionNumber_data, "DIAL CODE", $DialCode_data) $Rate_data = ControlGetText("Automata v0.1 alpha", "Rate", $Rate_field) IniWrite($ProfilesINI, $SectionNumber_data, "RATE", $Rate_data) $EffDate_data = GUICtrlRead($EffDate_datefield) IniWrite($ProfilesINI, $SectionNumber_data, "EFFECTIVE DATE", $EffDate_data) $ExpDate_data = GUICtrlRead($ExpDate_datefield) IniWrite($ProfilesINI, $SectionNumber_data, "EXPIRY DATE", $ExpDate_data) $ServerDetails_data = ControlGetText("Automata v0.1 alpha", "Server Details Name", $ServerDetails_field) IniWrite($ProfilesINI, $SectionNumber_data, "SERVER DETAILS", $ServerDetails_data) $UidPass_data = ControlGetText("Automata v0.1 alpha", "User Id/Password", $UidPass_field) IniWrite($ProfilesINI, $SectionNumber_data, "USERID AND PASSWORD", $UidPass_data) _RefreshGridData() #cs ---------------------------------------------------------------------------- Capture and handle the button press for $RemFromGrid_button #ce ---------------------------------------------------------------------------- Case $RemFromGrid_button SoundPlay(@WindowsDir & "\media\Windows XP Pop-up Blocked.wav") $SelectedRow = _GUICtrlListView_GetSelectedIndices($BatchList_handle) + 1 If $SelectedRow > 1 Then $Grid_listdata_sections = IniReadSectionNames($ProfilesINI) $Ini_Section_delete = $Grid_listdata_sections[$SelectedRow] IniDelete($ProfilesINI, $Ini_Section_delete) For $c = $Grid_listdata_sections[$SelectedRow] To $Grid_listdata_sections[0] IniRenameSection($ProfilesINI, $Grid_listdata_sections[$c], $Grid_listdata_sections[$c] - 1) Next EndIf _RefreshGridData() #cs ---------------------------------------------------------------------------- Capture and handle the button press for $MoveUp_button #ce ---------------------------------------------------------------------------- Case $MoveUp_button $SelectedRow = _GUICtrlListView_GetSelectedIndices($BatchList_handle) + 1 $Grid_listdata_sections = IniReadSectionNames($ProfilesINI) _ArraySort($Grid_listdata_sections, 0, 1) If $SelectedRow > 1 Then $Selected_section = $Grid_listdata_sections[$SelectedRow] $Above_section = $Grid_listdata_sections[$SelectedRow - 1] $temp = 9999999 IniRenameSection($ProfilesINI, $Selected_section, $temp) IniRenameSection($ProfilesINI, $Above_section, $Grid_listdata_sections[$SelectedRow]) IniRenameSection($ProfilesINI, $temp, $Grid_listdata_sections[$SelectedRow - 1]) EndIf _RefreshGridData() #cs ---------------------------------------------------------------------------- Capture and handle the button press for $MoveDown_button #ce ---------------------------------------------------------------------------- Case $MoveDown_button SoundPlay(@WindowsDir & "\media\Windows XP Pop-up Blocked.wav") $SelectedRow = _GUICtrlListView_GetSelectedIndices($BatchList_handle) + 1 $Grid_listdata_sections = IniReadSectionNames($ProfilesINI) _ArraySort($Grid_listdata_sections, 0, 1) If $SelectedRow < $Grid_listdata_sections[0] Then $Selected_section = $Grid_listdata_sections[$SelectedRow] $Below_section = $Grid_listdata_sections[$SelectedRow + 1] MsgBox(0, $Selected_section, $Below_section) $temp = "xxx" IniRenameSection($ProfilesINI, $Selected_section, $temp) IniRenameSection($ProfilesINI, $Below_section, $Selected_section) IniRenameSection($ProfilesINI, $temp, $Below_section) EndIf _RefreshGridData() #cs ---------------------------------------------------------------------------- Capture and handle the button press for $GridToFile_button #ce ---------------------------------------------------------------------------- Case $GridToFile_button SoundPlay(@WindowsDir & "\media\Windows XP Pop-up Blocked.wav") $ProfilesIniFileList_array = _FileListToArray(@ScriptDir & "\Profiles\", "*.ini", 1) $ProfilesINI_NewName = FileSaveDialog("Save the Grid data to an INI File", @ScriptDir & "\Profiles", "INI Files (*.ini)", 16, "Profile Number " & $ProfilesIniFileList_array[0]) FileCopy($ProfilesINI, $ProfilesINI_NewName & ".ini") $ProfilesINI_OnlyFileName = _PathSplit($ProfilesINI_NewName & ".ini", $szDrive, $szDir, $szFName, $szExt) MsgBox(8192, "Task Update", "The grid data has been saved to the File: " & $szFName & $szExt) _RefreshTabBar() $iIndex = _GUICtrlTab_FindTab($Tab_TCSuite, $szFName) _GUICtrlTab_ClickTab($Tab_TCSuite, $iIndex) #cs ---------------------------------------------------------------------------- Capture and handle the button press for $DeleteProfile_button #ce ---------------------------------------------------------------------------- Case $DeleteProfile_button SoundPlay(@WindowsDir & "\media\Windows XP Pop-up Blocked.wav") ; Get current tab name $current = _GUICtrlTab_GetCurSel($Tab_TCSuite) $Tab_Name = _GUICtrlTab_GetItemText($Tab_TCSuite, $current) $ProfilesINI = @ScriptDir & "\Profiles\" & $Tab_Name & ".ini" ; If Default profile selected then don't allow to delete, else proceed with delete. If $Tab_Name = "NEW PROFILE" Then MsgBox(16, "Information: Deletion", "The Default profile cannot be deleted") Else $msg_output = MsgBox(49, "Confirmation: Deletion", "Are you sure you want to delete the profile?") ; If OK pressed, then go ahead with delete If $msg_output = "1" Then ; Delete the tab _GUICtrlTab_DeleteItem($Tab_TCSuite, $current) ; Delete the file FileDelete($ProfilesINI) ; Refresh Tab bar _RefreshTabBar() EndIf EndIf #cs ---------------------------------------------------------------------------- Capture and handle the button press for $RunBatch_button #ce ---------------------------------------------------------------------------- Case $RunBatch_button SoundPlay(@WindowsDir & "\media\Windows XP Pop-up Blocked.wav") ; Disable all interactables GUICtrlSetState($AddtoBatch_button, $GUI_HIDE) GUICtrlSetState($RemFromGrid_button, $GUI_HIDE) GUICtrlSetState($MoveUp_button, $GUI_HIDE) GUICtrlSetState($MoveDown_button, $GUI_HIDE) GUICtrlSetState($DeleteProfile_button, $GUI_HIDE) GUICtrlSetState($GridToFile_button, $GUI_HIDE) GUICtrlSetState($RunBatch_button, $GUI_HIDE) ;~ ; Delete all tabs except the one selected. Code needs to be redone ;~ For $i = 0 To _GUICtrlTab_GetItemCount($Tab_TCSuite) - 1 Step 1 ;~ If $i <> _GUICtrlTab_GetCurSel($Tab_TCSuite) Then ;~ _GUICtrlTab_DeleteItem($Tab_TCSuite, $i) ;~ EndIf ;~ Next ; Set profile name in Cache $current = _GUICtrlTab_GetCurSel($Tab_TCSuite) $Tab_Name = _GUICtrlTab_GetItemText($Tab_TCSuite, $current) IniWrite($Cache_Main_file, "CURRENT PROFILE DETAILS", "CURRENT PROFILE", $Tab_Name & ".ini") ; Pass control to Main script ShellExecuteWait(@AutoItExe, '"System\Main.au3"') ; After execution, Activate the Automata GUI WinActivate("Automata v0.1 alpha") ; After execution, pass control to Summary screen. Using a msgbox for the time being ShellExecute(@AutoItExe, '"System\Summary.au3"') ; After execution, re-enable all buttons GUICtrlSetState($AddtoBatch_button, $GUI_SHOW) GUICtrlSetState($RemFromGrid_button, $GUI_SHOW) GUICtrlSetState($MoveUp_button, $GUI_SHOW) GUICtrlSetState($MoveDown_button, $GUI_SHOW) GUICtrlSetState($DeleteProfile_button, $GUI_SHOW) GUICtrlSetState($GridToFile_button, $GUI_SHOW) GUICtrlSetState($RunBatch_button, $GUI_SHOW) ; After execution, Refresh the grid so that it shows proper status _RefreshGridData() #cs ######################################################################################################################################################## Capture and execute all the GUI close events #ce ######################################################################################################################################################## Case $GUI_EVENT_CLOSE If $msg[1] = $AboutScreen_GUI Then GUIDelete($AboutScreen_GUI) $AboutScreen_GUI = 0 Else SoundPlay(@WindowsDir & "\media\Windows XP Pop-up Blocked.wav") Exit EndIf #cs ######################################################################################################################################################## Capture and execute tab changes. every tab click is captured and fires an event to refresh the grid accordingly #ce ######################################################################################################################################################## Case $Tab_TCSuite And $msg[1] = $MainImportGUI SoundPlay(@WindowsDir & "\media\Windows XP Pop-up Blocked.wav") $current = _GUICtrlTab_GetCurSel($Tab_TCSuite) $Tab_Name = _GUICtrlTab_GetItemText($Tab_TCSuite, $current) $ProfilesINI = @ScriptDir & "\Profiles\" & $Tab_Name & ".ini" ; This is a temp solution to stop the contineous refresh problem. If $current <> $GenericTempValue Then _RefreshGridData() EndIf $GenericTempValue = $current EndSwitch WEnd #cs ######################################################################################################################################################## Handling various functions #ce ######################################################################################################################################################## #cs ---------------------------------------------------------------------------- Function to refresh grid data #ce ---------------------------------------------------------------------------- Func _RefreshGridData() $current = _GUICtrlTab_GetCurSel($Tab_TCSuite) $Tab_Name = _GUICtrlTab_GetItemText($Tab_TCSuite, $current) $ProfilesINI = @ScriptDir & "\Profiles\" & $Tab_Name & ".ini" $Grid_listdata_sections = IniReadSectionNames($ProfilesINI) If @error Then _GUICtrlListView_DeleteAllItems($BatchList_handle) ElseIf $Grid_listdata_sections[0] > 0 Then _GUICtrlListView_BeginUpdate($BatchList_handle) _GUICtrlListView_DeleteAllItems($BatchList_handle) For $a = 1 To $Grid_listdata_sections[0] _ArraySort($Grid_listdata_sections, 0, 1) $Grid_All_listdata = IniReadSection($ProfilesINI, $Grid_listdata_sections[$a]) If Not @error Then If $Grid_All_listdata[0][0] > 0 Then ; Add serial number _GUICtrlListView_AddItem($BatchList_handle, $a) ; Add the test case sequence _GUICtrlListView_AddSubItem($BatchList_handle, $a - 1, $Grid_listdata_sections[$a], 1) ; Add the timestamp _GUICtrlListView_AddSubItem($BatchList_handle, $a - 1, IniRead($Cache_GridStatus_file, $Grid_listdata_sections[$a], "TIMESTAMP", ""), 2) ; Load images. Create an Imagelist. Then call the proper imagelist items in the TC status cell $hImage = _GUIImageList_Create(16, 16, 5, 3) _GUIImageList_AddIcon($hImage, $IconsFolder & "\STATUS_QUEUED.ico") _GUIImageList_AddIcon($hImage, $IconsFolder & "\STATUS_STARTED.ico") _GUIImageList_AddIcon($hImage, $IconsFolder & "\STATUS_PASSED.ico") _GUIImageList_AddIcon($hImage, $IconsFolder & "\STATUS_FAILED.ico") _GUICtrlListView_SetImageList($BatchList, $hImage, 1) ; Add the TC status If IniRead($Cache_GridStatus_file, $Grid_listdata_sections[$a], "TEST CASE STATUS", "") = "QUEUED" Then _GUICtrlListView_AddSubItem($BatchList_handle, $a - 1, IniRead($Cache_GridStatus_file, $Grid_listdata_sections[$a], "TEST CASE STATUS", ""), 3, 0) ElseIf IniRead($Cache_GridStatus_file, $Grid_listdata_sections[$a], "TEST CASE STATUS", "") = "STARTED" Then _GUICtrlListView_AddSubItem($BatchList_handle, $a - 1, IniRead($Cache_GridStatus_file, $Grid_listdata_sections[$a], "TEST CASE STATUS", ""), 3, 1) ElseIf IniRead($Cache_GridStatus_file, $Grid_listdata_sections[$a], "TEST CASE STATUS", "") = "PASSED" Then _GUICtrlListView_AddSubItem($BatchList_handle, $a - 1, IniRead($Cache_GridStatus_file, $Grid_listdata_sections[$a], "TEST CASE STATUS", ""), 3, 2) ElseIf IniRead($Cache_GridStatus_file, $Grid_listdata_sections[$a], "TEST CASE STATUS", "") = "FAILED" Then _GUICtrlListView_AddSubItem($BatchList_handle, $a - 1, IniRead($Cache_GridStatus_file, $Grid_listdata_sections[$a], "TEST CASE STATUS", ""), 3, 3) EndIf ; Add the Time Taken If IniRead($Cache_GridStatus_file, $Grid_listdata_sections[$a], "TIME TAKEN", "") <> "" Then _GUICtrlListView_AddSubItem($BatchList_handle, $a - 1, IniRead($Cache_GridStatus_file, $Grid_listdata_sections[$a], "TIME TAKEN", "") & " Sec", 4) EndIf ; Add TEST CASE NAME _GUICtrlListView_AddSubItem($BatchList_handle, $a - 1, IniRead($ProfilesINI, $Grid_listdata_sections[$a], "TEST CASE NAME", ""), 5) ; Add PASS NUMBER _GUICtrlListView_AddSubItem($BatchList_handle, $a - 1, IniRead($ProfilesINI, $Grid_listdata_sections[$a], "PASS NUMBER", ""), 6) ; Add CARRIER NAME _GUICtrlListView_AddSubItem($BatchList_handle, $a - 1, IniRead($ProfilesINI, $Grid_listdata_sections[$a], "CARRIER NAME", ""), 7) ; Add TEST TYPE _GUICtrlListView_AddSubItem($BatchList_handle, $a - 1, IniRead($ProfilesINI, $Grid_listdata_sections[$a], "TEST TYPE", ""), 8) ; Add DETAILS _GUICtrlListView_AddSubItem($BatchList_handle, $a - 1, IniRead($ProfilesINI, $Grid_listdata_sections[$a], "DETAILS", ""), 9) ; Add CURRENCY _GUICtrlListView_AddSubItem($BatchList_handle, $a - 1, IniRead($ProfilesINI, $Grid_listdata_sections[$a], "CURRENCY", ""), 10) ; Add IMPORT FILE _GUICtrlListView_AddSubItem($BatchList_handle, $a - 1, IniRead($ProfilesINI, $Grid_listdata_sections[$a], "IMPORT FILE", ""), 11) ; Add INCREASE DATE. concatante date data into a single variable $IncrDate_data = IniRead($ProfilesINI, $Grid_listdata_sections[$a], "INCREASE DATE MONTH", "") & "/" & IniRead($ProfilesINI, $Grid_listdata_sections[$a], "INCREASE DATE DAY", "") & "/" & IniRead($ProfilesINI, $Grid_listdata_sections[$a], "INCREASE DATE YEAR", "") _GUICtrlListView_AddSubItem($BatchList_handle, $a - 1, $IncrDate_data, 12) ; Add DECREASE DATE. concatante date data into a single variable $DecrDate_data = IniRead($ProfilesINI, $Grid_listdata_sections[$a], "DECREASE DATE MONTH", "") & "/" & IniRead($ProfilesINI, $Grid_listdata_sections[$a], "DECREASE DATE DAY", "") & "/" & IniRead($ProfilesINI, $Grid_listdata_sections[$a], "DECREASE DATE YEAR", "") _GUICtrlListView_AddSubItem($BatchList_handle, $a - 1, $DecrDate_data, 13) ; Add Additional Dates _GUICtrlListView_AddSubItem($BatchList_handle, $a - 1, IniRead($ProfilesINI, $Grid_listdata_sections[$a], "USE ADDITIONAL DATES", "0"), 14) ; Add Currency Alias Option _GUICtrlListView_AddSubItem($BatchList_handle, $a - 1, IniRead($ProfilesINI, $Grid_listdata_sections[$a], "USE CURRENCY ALIAS", "0"), 15) ; Add DESTINATION _GUICtrlListView_AddSubItem($BatchList_handle, $a - 1, IniRead($ProfilesINI, $Grid_listdata_sections[$a], "DESTINATION", ""), 16) ; Add DIAL CODE _GUICtrlListView_AddSubItem($BatchList_handle, $a - 1, IniRead($ProfilesINI, $Grid_listdata_sections[$a], "DIAL CODE", ""), 17) ; Add RATE _GUICtrlListView_AddSubItem($BatchList_handle, $a - 1, IniRead($ProfilesINI, $Grid_listdata_sections[$a], "RATE", "0"), 18) ; Add EFFECTIVE DATE _GUICtrlListView_AddSubItem($BatchList_handle, $a - 1, IniRead($ProfilesINI, $Grid_listdata_sections[$a], "EFFECTIVE DATE", ""), 19) ; Add EXPIRY DATE _GUICtrlListView_AddSubItem($BatchList_handle, $a - 1, IniRead($ProfilesINI, $Grid_listdata_sections[$a], "EXPIRY DATE", ""), 20) ; Add SERVER DETAILS _GUICtrlListView_AddSubItem($BatchList_handle, $a - 1, IniRead($ProfilesINI, $Grid_listdata_sections[$a], "SERVER DETAILS", ""), 21) ; Add USERID AND PASSWORD _GUICtrlListView_AddSubItem($BatchList_handle, $a - 1, IniRead($ProfilesINI, $Grid_listdata_sections[$a], "USERID AND PASSWORD", ""), 22) EndIf EndIf Next For $a = 0 To _GUICtrlListView_GetColumnCount($BatchList_handle) _GUICtrlListView_SetColumnWidth($BatchList_handle, $a, $LVSCW_AUTOSIZE_USEHEADER) Next _GUICtrlListView_EndUpdate($BatchList_handle) EndIf EndFunc ;==>_RefreshGridData #cs ---------------------------------------------------------------------------- Function to refresh tab bar #ce ---------------------------------------------------------------------------- Func _RefreshTabBar() ; DELETE ALL CURRENT TAB ITEMS SO THAT THE TAB BAR CAN BE RECREATED _GUICtrlTab_DeleteAllItems($Tab_TCSuite) ; GET ALL INI FILES IN THE PROFILES FOLDER IN AN ARRAY $ProfilesIniFileList_array = _FileListToArray(@ScriptDir & "\Profiles\", "*.ini", 1) ; CREATE THE DEFAULT TAB _GUICtrlTab_InsertItem($Tab_TCSuite, 0, "NEW PROFILE") ; ADD TABS TO TAB BAR BASED ON THE $IniFileList_array DATA If @error = 0 Then For $d = 1 To $ProfilesIniFileList_array[0] If $ProfilesIniFileList_array[$d] <> "NEW PROFILE.ini" Then $Tab_Insert_Name = StringTrimRight($ProfilesIniFileList_array[$d], 4) _GUICtrlTab_InsertItem($Tab_TCSuite, $d, $Tab_Insert_Name) EndIf Next EndIf EndFunc ;==>_RefreshTabBar #cs ---------------------------------------------------------------------------- Create the About screen which is launched on pressing F1 #ce ---------------------------------------------------------------------------- Func _AboutScreen() $AboutScreen_GUI = GUICreate("About Automata v0.1 alpha", 500, 300, -1, -1) $AboutScreen_label = GUICtrlCreateLabel("Rishav is having his pet gnomes slug it out on a worthwhile About screen. " & @LF & "That, or he is being lazy. Have patience. One day hitting F1 will bear fruits.", 50, 100, 390, 200) GUICtrlSetFont($AboutScreen_label, 12) GUISetState() EndFunc ;==>_AboutScreen #cs ---------------------------------------------------------------------------- Create the popup screen for Additional dates #ce ---------------------------------------------------------------------------- Func _AdditionDatesScreen() $AdditionalDates_gui = GUICreate("Additional Dates", 220, 400, -1, -1, -1, -1) GUISetState() ; Add the Date field $AdditionalDates_datefield = GUICtrlCreateDate("", 10, 10, 0, 0) $AdditionalDates_Add_button = GUICtrlCreateButton("Add", 10, 40, 80, 30) $AdditionalDates_Rem_button = GUICtrlCreateButton("Remove", 130, 40, 80, 30) $AdditionalDates_handle = GUICtrlGetHandle($AdditionalDates_datefield) _GUICtrlDTP_SetFormat($AdditionalDates_handle, "ddd, dd/MMM/yyyy") ; Add the Grid $AdditionalDates_grid = GUICtrlCreateListView("", 10, 80, 200, 310, BitOR(-1, $LVS_NOSORTHEADER, $WS_VSCROLL), BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_HEADERDRAGDROP, $LVS_EX_SUBITEMIMAGES, $LVS_EX_DOUBLEBUFFER)) _GUICtrlListView_AddColumn($AdditionalDates_grid, "List of Additional Dates", 200, 2) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_AdditionDatesScreen #cs ---------------------------------------------------------------------------- Create the popup screen for Currency aliases #ce ---------------------------------------------------------------------------- Func _CurrencyAliasScreen() $CurrencyAlias_gui = GUICreate("Currency Aliases", 400, 400, -1, -1, -1, -1) GUISetState() ; Add the gui elements $CurrencyAlias_name_label = GUICtrlCreateLabel("Name", 10, 10, 30) $CurrencyAlias_name_field = GUICtrlCreateInput("", 50, 10, 140) $CurrencyAlias_alias_label = GUICtrlCreateLabel("Alias", 200, 10, 40) $CurrencyAlias_alias_field = GUICtrlCreateInput("", 250, 10, 140) $CurrencyAlias_Add_button = GUICtrlCreateButton("Add", 50, 40, 80, 30) $CurrencyAlias_Rem_button = GUICtrlCreateButton("Remove", 250, 40, 80, 30) ; Add the Grid $CurrencyAlias_grid = GUICtrlCreateListView("", 10, 80, 380, 310, BitOR(-1, $LVS_NOSORTHEADER, $WS_VSCROLL), BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_HEADERDRAGDROP, $LVS_EX_SUBITEMIMAGES, $LVS_EX_DOUBLEBUFFER)) _GUICtrlListView_AddColumn($CurrencyAlias_grid, "Currency Name", 190, 2) _GUICtrlListView_AddColumn($CurrencyAlias_grid, "Currency Alias", 190, 2) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_CurrencyAliasScreenregardsRishavedit: sorry, wrong forum i guess. it should have gone in the GUI section. :/ Edited September 1, 2009 by Rishav Link to comment Share on other sites More sharing options...
Manjish Posted September 1, 2009 Share Posted September 1, 2009 (edited) As far as I see it.. In your script you haven't defined what must be done when the add and remove buttons on currency alias screen is clicked.. If you don't define it, nothing will happen if u click the buttons. Here's what I mean. This is the GUI of currency alias screen: #include<listviewconstants.au3> #include<guiconstants.au3> #include<windowsconstants.au3> #include<guilistview.au3> $CurrencyAlias_gui = GUICreate("Currency Aliases", 400, 400, -1, -1, -1, -1) ;GUISetState() ; Add the gui elements $CurrencyAlias_name_label = GUICtrlCreateLabel("Name", 10, 10, 30) $CurrencyAlias_name_field = GUICtrlCreateInput("", 50, 10, 140) $CurrencyAlias_alias_label = GUICtrlCreateLabel("Alias", 200, 10, 40) $CurrencyAlias_alias_field = GUICtrlCreateInput("", 250, 10, 140) $CurrencyAlias_Add_button = GUICtrlCreateButton("Add", 50, 40, 80, 30) $CurrencyAlias_Rem_button = GUICtrlCreateButton("Remove", 250, 40, 80, 30) ; Add the Grid $CurrencyAlias_grid = GUICtrlCreateListView("", 10, 80, 380, 310, BitOR(-1, $LVS_NOSORTHEADER, $WS_VSCROLL), BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_HEADERDRAGDROP, $LVS_EX_SUBITEMIMAGES, $LVS_EX_DOUBLEBUFFER)) _GUICtrlListView_AddColumn($CurrencyAlias_grid, "Currency Name", 190, 2) _GUICtrlListView_AddColumn($CurrencyAlias_grid, "Currency Alias", 190, 2) GUISetState(@sw_show) while 1 $vmsg1=GUIGetMsg() Switch $vmsg1 Case $CurrencyAlias_Add_button MsgBox(4096,"Click","you clicked add") Case $CurrencyAlias_Rem_button MsgBox(4096,"Click","you clicked remove") Case $gui_event_close GUIDelete() EndSwitch WEnd Edited September 1, 2009 by Manjish [font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com Link to comment Share on other sites More sharing options...
Rishav Posted September 1, 2009 Author Share Posted September 1, 2009 Hi Manjish I am checking for the button clicks in the main While do loop. you can just Ctrl+F for $CurrencyAlias_Add_button and $AdditionalDates_Add_button. I am not checking for the button presses in the individual gui functions. and thanks for replying. Link to comment Share on other sites More sharing options...
Rishav Posted September 1, 2009 Author Share Posted September 1, 2009 I guess the number of lines in there can be too much.I have just contained the problem in a teeny tiny UI with just the necessary controls.expandcollapse popup#include <GUIConstantsEx.au3> #include <GuiDateTimePicker.au3> #include <GuiListView.au3> Local $Button_1, $Button_2, $msg, $AdditionalDates_Add_button, $CurrencyAlias_Add_button, $AdditionalDates_gui, $CurrencyAlias_gui $main_gui = GUICreate("My GUI Button") $Button_1 = GUICtrlCreateButton("Button 1", 50, 100, 100, 50) $Button_2 = GUICtrlCreateButton("Button 2", 150, 100, 100, 50) GUISetState() While 1 $msg = GUIGetMsg(1) Select Case $msg[0] = $GUI_EVENT_CLOSE ExitLoop Case $msg[0] = $Button_1 _AdditionDatesScreen() Case $msg[0] = $Button_2 _CurrencyAliasScreen() Case $msg[0] = $AdditionalDates_Add_button And $msg[1] = $AdditionalDates_gui And $msg[2] = $AdditionalDates_Add_button ;~ MsgBox(0, "$AdditionalDates_Add_button pressed!", $msg[0] & @CRLF & $msg[1] & @CRLF & $msg[2]) Case $msg[0] = $CurrencyAlias_Add_button MsgBox(0, "$CurrencyAlias_Add_button pressed!", $msg[0] & @CRLF & $msg[1] & @CRLF & $msg[2]) EndSelect WEnd Func _AdditionDatesScreen() $AdditionalDates_gui = GUICreate("Additional Dates", 220, 400, -1, -1, -1, -1) GUISetState() ; Add the Date field $AdditionalDates_datefield = GUICtrlCreateDate("", 10, 10, 0, 0) $AdditionalDates_Add_button = GUICtrlCreateButton("Add", 10, 40, 80, 30) $AdditionalDates_Rem_button = GUICtrlCreateButton("Remove", 130, 40, 80, 30) $AdditionalDates_handle = GUICtrlGetHandle($AdditionalDates_datefield) _GUICtrlDTP_SetFormat($AdditionalDates_handle, "ddd, dd/MMM/yyyy") ; Add the Grid $AdditionalDates_grid = GUICtrlCreateListView("", 10, 80, 200, 310) _GUICtrlListView_AddColumn($AdditionalDates_grid, "List of Additional Dates", 200, 2) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_AdditionDatesScreen #cs ---------------------------------------------------------------------------- Create the popup screen for Currency aliases #ce ---------------------------------------------------------------------------- Func _CurrencyAliasScreen() $CurrencyAlias_gui = GUICreate("Currency Aliases", 400, 400, -1, -1, -1, -1) GUISetState() ; Add the gui elements $CurrencyAlias_name_label = GUICtrlCreateLabel("Name", 10, 10, 30) $CurrencyAlias_name_field = GUICtrlCreateInput("", 50, 10, 140) $CurrencyAlias_alias_label = GUICtrlCreateLabel("Alias", 200, 10, 40) $CurrencyAlias_alias_field = GUICtrlCreateInput("", 250, 10, 140) $CurrencyAlias_Add_button = GUICtrlCreateButton("Add", 50, 40, 80, 30) $CurrencyAlias_Rem_button = GUICtrlCreateButton("Remove", 250, 40, 80, 30) ; Add the Grid $CurrencyAlias_grid = GUICtrlCreateListView("", 10, 80, 380, 310) _GUICtrlListView_AddColumn($CurrencyAlias_grid, "Currency Name", 190, 2) _GUICtrlListView_AddColumn($CurrencyAlias_grid, "Currency Alias", 190, 2) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_CurrencyAliasScreenI still need the msgbox events to be invoked properly on cli8cking the $AdditionalDates_Add_button and $CurrencyAlias_Add_button buttons.I am not getting what exactly I am doing wrong?regardsRishav Link to comment Share on other sites More sharing options...
Manjish Posted September 1, 2009 Share Posted September 1, 2009 (edited) Ok I get what you mean.. Ok an important thing here. This is what you are doing wrong. When you invoke the currency gui, it goes into the function for creating individual GUI and stays there till you click close button, due to the do until loop. So it doesn't even check the button press in main while loop, since it's still stuck in the do until loop. So it's best to creat a while loop in curreny gui function and give your button click functions there itself, as I have shown above. Edited September 1, 2009 by Manjish [font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com Link to comment Share on other sites More sharing options...
Rishav Posted September 1, 2009 Author Share Posted September 1, 2009 hmmmm... it totally makes sense. I'll just give it a try and pop back here to report on it. brb. Link to comment Share on other sites More sharing options...
Rishav Posted September 1, 2009 Author Share Posted September 1, 2009 Now have the opposite problem. Once the control passes to the while-do loop of the popup screens, it doesnt returns to the main loop. ie. once I click and open the popup GUI and then close it, then i can't use the buttons 1 and 2 again. expandcollapse popup#include <GUIConstantsEx.au3> #include <GuiDateTimePicker.au3> #include <GuiListView.au3> Local $Button_1, $Button_2, $msg, $AdditionalDates_Add_button, $CurrencyAlias_Add_button, $AdditionalDates_gui, $CurrencyAlias_gui $main_gui = GUICreate("My GUI Button") $Button_1 = GUICtrlCreateButton("Button 1", 50, 100, 100, 50) $Button_2 = GUICtrlCreateButton("Button 2", 150, 100, 100, 50) GUISetState() While 1 $msg = GUIGetMsg(1) Select Case $msg[0] = $GUI_EVENT_CLOSE and $msg[1]=$main_gui GUIDelete($main_gui) Exit Case $msg[0] = $Button_1 _AdditionDatesScreen() Case $msg[0] = $Button_2 _CurrencyAliasScreen() EndSelect WEnd Func _AdditionDatesScreen() $AdditionalDates_gui = GUICreate("Additional Dates", 220, 400, -1, -1, -1, -1) GUISetState() ; Add the Date field $AdditionalDates_datefield = GUICtrlCreateDate("", 10, 10, 0, 0) $AdditionalDates_Add_button = GUICtrlCreateButton("Add", 10, 40, 80, 30) $AdditionalDates_Rem_button = GUICtrlCreateButton("Remove", 130, 40, 80, 30) $AdditionalDates_handle = GUICtrlGetHandle($AdditionalDates_datefield) _GUICtrlDTP_SetFormat($AdditionalDates_handle, "ddd, dd/MMM/yyyy") ; Add the Grid $AdditionalDates_grid = GUICtrlCreateListView("", 10, 80, 200, 310) _GUICtrlListView_AddColumn($AdditionalDates_grid, "List of Additional Dates", 200, 2) GUISetState(@sw_show) while 1 $vmsg2=GUIGetMsg() Switch $vmsg2 Case $AdditionalDates_Add_button MsgBox(0, "Additional Dates","ADD") Case $AdditionalDates_Rem_button MsgBox(0,"Additional Dates","REMOVE") Case $gui_event_close GUIDelete($AdditionalDates_gui) EndSwitch WEnd EndFunc ;==>_AdditionDatesScreen #cs ---------------------------------------------------------------------------- Create the popup screen for Currency aliases #ce ---------------------------------------------------------------------------- Func _CurrencyAliasScreen() $CurrencyAlias_gui = GUICreate("Currency Aliases", 400, 400, -1, -1, -1, -1) ;GUISetState() ; Add the gui elements $CurrencyAlias_name_label = GUICtrlCreateLabel("Name", 10, 10, 30) $CurrencyAlias_name_field = GUICtrlCreateInput("", 50, 10, 140) $CurrencyAlias_alias_label = GUICtrlCreateLabel("Alias", 200, 10, 40) $CurrencyAlias_alias_field = GUICtrlCreateInput("", 250, 10, 140) $CurrencyAlias_Add_button = GUICtrlCreateButton("Add", 50, 40, 80, 30) $CurrencyAlias_Rem_button = GUICtrlCreateButton("Remove", 250, 40, 80, 30) ; Add the Grid $CurrencyAlias_grid = GUICtrlCreateListView("", 10, 80, 380, 310) _GUICtrlListView_AddColumn($CurrencyAlias_grid, "Currency Name", 190, 2) _GUICtrlListView_AddColumn($CurrencyAlias_grid, "Currency Alias", 190, 2) GUISetState(@sw_show) while 1 $vmsg1=GUIGetMsg() Switch $vmsg1 Case $CurrencyAlias_Add_button MsgBox(0, "CURRENCY ALIAS","ADD") Case $CurrencyAlias_Rem_button MsgBox(0,"CURRENCY ALIAS","REMOVE") Case $gui_event_close GUIDelete() EndSwitch WEnd EndFunc ;==>_CurrencyAliasScreen Link to comment Share on other sites More sharing options...
Rishav Posted September 1, 2009 Author Share Posted September 1, 2009 i alongwith the help of my superawesomely great intelligence just solved it. all it needed was an exitloop on guieventclose. i am furious now. i must go and club a baby seal.expandcollapse popup#include <GUIConstantsEx.au3> #include <GuiDateTimePicker.au3> #include <GuiListView.au3> Local $Button_1, $Button_2, $msg, $AdditionalDates_Add_button, $CurrencyAlias_Add_button, $AdditionalDates_gui, $CurrencyAlias_gui $main_gui = GUICreate("My GUI Button") $Button_1 = GUICtrlCreateButton("Button 1", 50, 100, 100, 50) $Button_2 = GUICtrlCreateButton("Button 2", 150, 100, 100, 50) GUISetState() While 1 $msg = GUIGetMsg(1) Select Case $msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $main_gui GUIDelete($main_gui) Exit Case $msg[0] = $Button_1 _AdditionDatesScreen() Case $msg[0] = $Button_2 _CurrencyAliasScreen() EndSelect WEnd Func _AdditionDatesScreen() $AdditionalDates_gui = GUICreate("Additional Dates", 220, 400, -1, -1, -1, -1) GUISetState() ; Add the Date field $AdditionalDates_datefield = GUICtrlCreateDate("", 10, 10, 0, 0) $AdditionalDates_Add_button = GUICtrlCreateButton("Add", 10, 40, 80, 30) $AdditionalDates_Rem_button = GUICtrlCreateButton("Remove", 130, 40, 80, 30) $AdditionalDates_handle = GUICtrlGetHandle($AdditionalDates_datefield) _GUICtrlDTP_SetFormat($AdditionalDates_handle, "ddd, dd/MMM/yyyy") ; Add the Grid $AdditionalDates_grid = GUICtrlCreateListView("", 10, 80, 200, 310) _GUICtrlListView_AddColumn($AdditionalDates_grid, "List of Additional Dates", 200, 2) GUISetState(@SW_SHOW) While 1 $vmsg2 = GUIGetMsg() Switch $vmsg2 Case $AdditionalDates_Add_button MsgBox(0, "Additional Dates", "ADD") Case $AdditionalDates_Rem_button MsgBox(0, "Additional Dates", "REMOVE") Case $GUI_EVENT_CLOSE GUIDelete($AdditionalDates_gui) ExitLoop EndSwitch WEnd EndFunc ;==>_AdditionDatesScreen #cs ---------------------------------------------------------------------------- Create the popup screen for Currency aliases #ce ---------------------------------------------------------------------------- Func _CurrencyAliasScreen() $CurrencyAlias_gui = GUICreate("Currency Aliases", 400, 400, -1, -1, -1, -1) ;GUISetState() ; Add the gui elements $CurrencyAlias_name_label = GUICtrlCreateLabel("Name", 10, 10, 30) $CurrencyAlias_name_field = GUICtrlCreateInput("", 50, 10, 140) $CurrencyAlias_alias_label = GUICtrlCreateLabel("Alias", 200, 10, 40) $CurrencyAlias_alias_field = GUICtrlCreateInput("", 250, 10, 140) $CurrencyAlias_Add_button = GUICtrlCreateButton("Add", 50, 40, 80, 30) $CurrencyAlias_Rem_button = GUICtrlCreateButton("Remove", 250, 40, 80, 30) ; Add the Grid $CurrencyAlias_grid = GUICtrlCreateListView("", 10, 80, 380, 310) _GUICtrlListView_AddColumn($CurrencyAlias_grid, "Currency Name", 190, 2) _GUICtrlListView_AddColumn($CurrencyAlias_grid, "Currency Alias", 190, 2) GUISetState(@SW_SHOW) While 1 $vmsg1 = GUIGetMsg() Switch $vmsg1 Case $CurrencyAlias_Add_button MsgBox(0, "CURRENCY ALIAS", "ADD") Case $CurrencyAlias_Rem_button MsgBox(0, "CURRENCY ALIAS", "REMOVE") Case $GUI_EVENT_CLOSE GUIDelete() ExitLoop EndSwitch WEnd EndFunc ;==>_CurrencyAliasScreenand thanks for all your help.regardsRishav 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