cherdeg Posted September 15, 2008 Share Posted September 15, 2008 ...depending on the value selected in a combobox of the same GUI? Thank you very much, Regards, Chris Link to comment Share on other sites More sharing options...
dworld Posted September 15, 2008 Share Posted September 15, 2008 (edited) Hello cherdeg, I wrote it, but I didn't find the way to disable the whole group control, so I disabled the items one by one: expandcollapse popup#include <GUIConstants.au3> #include <GUIComboBox.au3> #include <ComboConstants.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 0) $Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work ;------------------------------------------------------------------------------------------------------------------------- Global $selectedItem Global $comboCheck CreateGUI() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd ;------------------------------------------------------------------------------------------------------------------------- Func CreateGUI() $hGUI = GUICreate("Group manipulate", 400, 400) $grpOne = GUICtrlCreateGroup("Group", 10, 10, 250, 250) GUIStartGroup() ; I'm not sure that we need this $radio_1 = GUICtrlCreateRadio("Radio 1", 30, 90, 60, 20) $radio_2 = GUICtrlCreateRadio("Radio 2", 30, 110, 60, 50) $comboCheck = _GUICtrlComboBox_Create($hGUI, "", 10, 270, 220, 120, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL)) ;_GUICtrlComboBox_BeginUpdate($comboCheck) _GUICtrlComboBox_AddString($comboCheck, "Enable") _GUICtrlComboBox_AddString($comboCheck, "Disable") ;_GUICtrlComboBox_EndUpdate($comboCheck) ; set default values _GUICtrlComboBox_SetCurSel($comboCheck, 0) GUICtrlSetState($radio_1, $GUI_CHECKED) ;~ ; Help to catch combobox events GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUISetState() EndFunc ;------------------------------------------------------------------------------------------------------------------------- Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg Local $hWndFrom, $iIDFrom, $iCode $hWndFrom = $ilParam $iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word $iCode = BitShift($iwParam, 16) ; Hi Word Switch $hWndFrom Case $comboCheck Switch $iCode Case $CBN_CLOSEUP ; Sent when the list box of a combo box has been closed Case $CBN_SELCHANGE ; Sent when the user changes the current selection in the list box of a combo box $selectedItem = _GUICtrlComboBox_GetCurSel($comboCheck) Switch $selectedItem Case 0 ControlEnable("Group manipulate", "", "[CLASS:Button; INSTANCE:2]") ; i know that there is other way ControlEnable("Group manipulate", "", "[CLASS:Button; INSTANCE:3]") ; to disable control but for it always work Case 1 ControlDisable("Group manipulate", "", "[CLASS:Button; INSTANCE:2]") ControlDisable("Group manipulate", "", "[CLASS:Button; INSTANCE:3]") EndSwitch EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND ;------------------------------------------------------------------------------------------------------------------------- I'll try to guess, how to do it, but if you are faster, please don't hesitate to share your code with us:) edit: It could be a solution, when you create the controls, store them in one array, and when you need you can disable them much faster and easier.. Edited September 15, 2008 by dworld dworldI'm new in autoit, but I like it. My mind is open to the new things. Link to comment Share on other sites More sharing options...
rover Posted September 15, 2008 Share Posted September 15, 2008 (edited) greetings cherdeg and dworldthe other two methods I am aware of to do this are:1start and end each group of controls sectionwith GUICtrlCreateDummy(), then use GUICtrlSetState()on the controls in the range between the two control IDsEdit: forgot to replace individual controls with singleGUICtrlSetState($i, $GUI_DISABLE) in For/Next loopCODE; Group 1 ------------------------------------------------$d1 = GUICtrlCreateDummy()$grpOne = GUICtrlCreateGroup("Group 2", 130, 10, 100, 270)$radio_1 = GUICtrlCreateRadio("Radio 1", 30, 90, 60, 20)$radio_2 = GUICtrlCreateRadio("Radio 2", 30, 110, 60, 50)$btn1 = GUICtrlCreateButton("Group 2", 150, 250, 60, 20)$d2 = GUICtrlCreateDummy();---------------------------------------------------------For $i = $d1+1 To $d2-1 GUICtrlSetState($i, $GUI_DISABLE)Next2use an array and create controls in loop if many radios or checkboxes neededthen use GUICtrlSetState() in a loop and set state of each control ID in the arrayif using UDF controls in the array, then check to see if control id is a Hwnd andrun appropriate controls UDF set state commandEdit1: not happy with using the ContinueCase line, it's fine for an example but if other case statements are addedit would no longer default to Case ElseEdit2: another coding without coffee errorno need to add 10 to $iSpace to set initial radio button placementEdit3: left out the closing group statementsexpandcollapse popup#include <GUIConstantsEX.au3> #include <WindowsConstants.au3> #include <GUIComboBox.au3> ;#include <ComboConstants.au3> Opt('MustDeclareVars', 0) ;------------------------------------------------------------------------------------------------------------------------- Global $selectedItem, $aGroup1[12], $aGroup2[12] Local $hGUI, $iSpace $hGUI = GUICreate("Group manipulate", 400, 400) $hcomboCheck = _GUICtrlComboBox_Create($hGUI, "", 10, 300, 220, 120, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL)) $idCombo = GUICtrlCreateDummy() ; Group 1 ------------------------------------------------ $iSpace = 30 $aGroup1[0] = GUICtrlCreateGroup("Group 1", 10, 10, 100, 270) For $i = 1 To 10 $aGroup1[$i] = GUICtrlCreateRadio("Radio " & $i, 30, $iSpace, 60, 20) $iSpace += 20 Next $aGroup1[11] = GUICtrlCreateButton("Group 1", 30, 250, 60, 20) GUICtrlCreateGroup("", -99, -99, 1, 1) ;--------------------------------------------------------- ; Group 2 ------------------------------------------------ $iSpace = 30 $aGroup2[0] = GUICtrlCreateGroup("Group 2", 130, 10, 100, 270) For $i = 1 To 10 $aGroup2[$i] = GUICtrlCreateRadio("Radio " & $i, 150, $iSpace, 60, 20) $iSpace += 20 Next $aGroup2[11] = GUICtrlCreateButton("Group 2", 150, 250, 60, 20) GUICtrlCreateGroup("", -99, -99, 1, 1) ;--------------------------------------------------------- ;_GUICtrlComboBox_BeginUpdate($hcomboCheck) _GUICtrlComboBox_AddString($hcomboCheck, "Select Group") _GUICtrlComboBox_AddString($hcomboCheck, "Group1 Disable") _GUICtrlComboBox_AddString($hcomboCheck, "Group2 Disable") ;_GUICtrlComboBox_EndUpdate($hcomboCheck) _GUICtrlComboBox_SetCurSel($hcomboCheck, 0) ;~ ; Help to catch combobox events GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idCombo _CheckCombo() EndSwitch WEnd Func _CheckCombo() Local $selectedItem = GUICtrlRead($idCombo), $aArray Switch $selectedItem Case 1, 2 $aArray = Execute("$aGroup" & $selectedItem) ;If Not IsArray($aArray) Then ContinueCase If Not IsArray($aArray) Then Return _GUICtrlComboBox_SetCurSel($hcomboCheck, 0) Select Case BitAND(GUICtrlGetState($aArray[0]), $GUI_DISABLE) = $GUI_DISABLE For $i = 0 To UBound($aArray) -1 GUICtrlSetState($aArray[$i], $GUI_ENABLE) Next _GUICtrlComboBox_DeleteString($hcomboCheck, $selectedItem) _GUICtrlComboBox_InsertString($hcomboCheck, "Group" & $selectedItem & " Disable", $selectedItem) Case BitAND(GUICtrlGetState($aArray[0]), $GUI_ENABLE) = $GUI_ENABLE For $i = 0 To UBound($aArray) -1 GUICtrlSetState($aArray[$i], $GUI_DISABLE) Next _GUICtrlComboBox_DeleteString($hcomboCheck, $selectedItem) _GUICtrlComboBox_InsertString($hcomboCheck, "Group" & $selectedItem & " Enable", $selectedItem) EndSelect Case Else EndSwitch _GUICtrlComboBox_SetCurSel($hcomboCheck, 0) EndFunc ;------------------------------------------------------------------------------------------------------------------------- Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg Local $hWndFrom, $iIDFrom, $iCode $hWndFrom = $ilParam $iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word $iCode = BitShift($iwParam, 16) ; Hi Word Switch $hWndFrom Case $hcomboCheck Switch $iCode Case $CBN_CLOSEUP ; Sent when the list box of a combo box has been closed Case $CBN_SELCHANGE ; Sent when the user changes the current selection in the list box of a combo box GUICtrlSendToDummy($idCombo, _GUICtrlComboBox_GetCurSel($hcomboCheck)) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND ;------------------------------------------------------------------------------------------------------------------------- Edited September 17, 2008 by rover I see fascists... Link to comment Share on other sites More sharing options...
dworld Posted September 15, 2008 Share Posted September 15, 2008 bravo rover i like your solution respect dworldI'm new in autoit, but I like it. My mind is open to the new things. Link to comment Share on other sites More sharing options...
rover Posted September 15, 2008 Share Posted September 15, 2008 bravo rover i like your solutionrespectthanks dworldI don't think I screwed up anything in my example this timeif I have I'll hear about it. >_< I see fascists... Link to comment Share on other sites More sharing options...
cherdeg Posted September 16, 2008 Author Share Posted September 16, 2008 Hello everybody! Sorry I didn't answer: I had no time to test your solutions yet, but I will do asap...and of course report back. For so long: thank you very much!!! Regards, Chris Link to comment Share on other sites More sharing options...
cherdeg Posted September 17, 2008 Author Share Posted September 17, 2008 Hey Rover, sorry, but I don't seem to get your code working...my GUI looks like this: expandcollapse popup; Main form containing "Task Selection" and "Network Tasks" / "System Tasks" groups $ge_Form_Main = GUICreate("Test D5100 PostInstall", 560, 428, -1, -1) $ge_Label_PWToolsShare = GUICtrlCreateLabel("Password to ""ToolsShare""", 278, 24, 141, 14) $ge_Input_PWToolsShare = GUICtrlCreateInput("", 278, 40, 130, 21, $ES_PASSWORD) Opt("GUICoordMode", 1) ; Create an array containing the selectable tasks and a combobox containing them Local $a_arrJOBS[3] $a_arrJOBS[0] = "System Configuration" $a_arrJOBS[1] = "Network Configuration" $a_arrJOBS[2] = "Network and System Configuration" $ge_Label_Main = GUICtrlCreateLabel("Please choose which tasks to process:", 16, 24, 121, 14) $ge_Combo_Tasks = GUICtrlCreateCombo($a_arrJOBS, 16, 40, 249, 300, 0x0003) For $i=0 To UBound($a_arrJOBS) - 1 GUICtrlSetData($ge_Combo_Tasks, $a_arrJOBS[$i], $a_arrJOBS[0]) Next ; Create the Start-Botton $ge_Buttonstart = GUICtrlCreateButton("Start !", 420, 37, 120, 25, 0) ; Group Network Tasks $ge_NetworkTasksGroup = GUICtrlCreateGroup("Networking", 8, 80, 537, 129) ; Network Connection Selection - Create a list of the network connections existing on the local host $a_ConnectionList = _NWConections($s_OSver) $s_ConnSelected = "" ; Create a combobox containing the network connections $ge_Label_Connection = GUICtrlCreateLabel("Please select the NIC to use:", 16, 102, 200, 17) $ge_Combo_Connection = GUICtrlCreateCombo($a_ConnectionList, 16, 118, 249, 300, 0x0003) For $i = 0 To UBound($a_ConnectionList) - 1 GUICtrlSetData($ge_Combo_Connection, $a_ConnectionList[$i], $a_ConnectionList[0]) Next ; Network Profile Selection - Create a list of network profiles from the .ini-File, 1st, read the "current" settings $s_CurrentProfile = IniRead($s_IniFile, "Settings", "Current", "") ; Create a list of all sections defined in the .ini file and define an array of the ones not being network profiles $a_IniSectionsAll = IniReadSectionNames($s_IniFile) _ArrayDelete($a_IniSectionsAll, 0) Global $a_IniSectionsConfig[4] = ["Settings", "ACL", "ServicePacks", "Users"] Global $a_IniSectionsProfiles = $a_IniSectionsAll ; Sort out the four Non-Network-Profile-Section For $i_i = 0 To UBound($a_IniSectionsConfig) - 1 $i_index = _ArraySearch($a_IniSectionsProfiles, $a_IniSectionsConfig[$i_i], 0, 0, 0, 1) If Not @error Then _ArrayDelete($a_IniSectionsProfiles, $i_index) EndIf Next ; Create a combobox containing the network profiles $ge_Label_NicProfile = GUICtrlCreateLabel("Please select the network profile to use:", 278, 102, 200, 17) $ge_Combo_NicProfile = GUICtrlCreateCombo($a_IniSectionsProfiles, 277, 118, 249, 300, 0x0003) For $i_i = 0 To UBound($a_IniSectionsProfiles) - 1 If $i_i < UBound($a_IniSectionsProfiles) - 1 Then GUICtrlSetData($ge_Combo_NicProfile, $a_IniSectionsProfiles[$i_i]) Else ; Set the running settings as Default GUICtrlSetData($ge_Combo_NicProfile, $a_IniSectionsProfiles[$i_i], $s_CurrentProfile) EndIf Next ; Create input fields for IP-Address, Subnet-Mask and Gateway $ge_Label_IP = GUICtrlCreateLabel("IP-Address (empty = DHCP)", 16, 153, 170, 14) $ge_Input_IP = GUICtrlCreateInput("", 16, 168, 121, 21) $ge_Label_SM = GUICtrlCreateLabel("Subnet-Mask", 216, 153, 150, 21) $ge_Input_SM = GUICtrlCreateInput("", 216, 168, 121, 21) $ge_Label_GW = GUICtrlCreateLabel("Gateway-IP", 416, 153, 100, 14) $ge_Input_GW = GUICtrlCreateInput("", 416, 168, 121, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) ; Group System Tasks $ge_SystemTasksGroup = GUICtrlCreateGroup("System", 8, 224, 537, 193) ; Create a combobox for the Domain membership selection Local $arrDom[4] $arrDom[0] = "Domain A" $arrDom[1] = "Domain B" $arrDom[2] = "Domain C" $arrDom[3] = "Domain D" $ge_Label_DomainToJoin = GUICtrlCreateLabel("Please select a Domain", 17, 248, 130, 17) $ge_Combo_DomainToJoin = GUICtrlCreateCombo($arrDom, 15, 272, 249, 300, 0x0003) For $i = 0 To UBound($arrDom) - 1 GUICtrlSetData($ge_Combo_DomainToJoin, $arrDom[$i], $arrDom[0]) Next ; Create the input field for the domain password $ge_Label_PWDomain = GUICtrlCreateLabel("Password to Domain", 278, 248, 115, 17) $ge_Input_PWDomain = GUICtrlCreateInput("", 278, 272, 130, 21, $ES_PASSWORD) ; Show the icon graphics for the current language $_ge_Label_Language = GUICtrlCreateLabel("Current Language", 432, 248, 90, 17) _GDIPlus_StartUp() Switch $s_KbdRegValue Case "00000407" $_ge_Pic_LanguageDE = GUICtrlCreatePic($s_ScriptHome & "\Tools\german.gif", 432, 272, 90, 60) Case "00000409" $_ge_Pic_LanguageUS = GUICtrlCreatePic($s_ScriptHome & "\Tools\american.gif", 432, 272, 90, 60) Case Else $ge_PNGimage = _GDIPlus_ImageLoadFromFile($s_ScriptHome & "\Tools\other.png") $ge_PNGgraphic = _GDIPlus_GraphicsCreateFromHWND($ge_Form_Main) GUIRegisterMsg($WM_PAINT, "MY_WM_PAINT") $_ge_Pic_LanguageOther = GUICtrlCreatePic($s_ScriptHome & "\Tools\other1.gif", 445, 272, 72, 72) EndSwitch ; Create the checkboxes for the system tasks $ge_Check_ServicePack = GUICtrlCreateCheckbox("ServicePack Installation", 15, 312, 150, 17) $ge_Check_RestartAfterWSUS = GUICtrlCreateCheckbox("Restart After WSUS", 15, 344, 150, 17) $ge_Check_SetACLs = GUICtrlCreateCheckbox("Set compliant ACLs", 15, 376, 150, 17) $ge_Check_Software = GUICtrlCreateCheckbox("Software Installation", 278, 312, 150, 17) $ge_Check_DomainJoin = GUICtrlCreateCheckbox("Join Domain", 278, 344, 150, 17) $ge_Check_Restart = GUICtrlCreateCheckbox("Restart", 278, 376, 150, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE _CloseClicked() Case $ge_Buttonstart ; Return the selected combobox values $s_JobSelected = GUICtrlRead($ge_Combo_Tasks) $s_PWToolsShare = GUICtrlRead($ge_Input_PWToolsShare) $s_ConnSelected = GUICtrlRead($ge_Combo_Connection) $s_LocSelected = GUICtrlRead($ge_Combo_NicProfile) $s_DomSelected = GUICtrlRead($ge_Combo_DomainToJoin) $s_PWDomain = GUICtrlRead($ge_Input_PWDomain) $s_ServicePack_YesNo = BitAND(GUICtrlRead($ge_Check_ServicePack), $GUI_CHECKED) $s_RestartAfterWSUS_YesNo = BitAND(GUICtrlRead($ge_Check_RestartAfterWSUS), $GUI_CHECKED) $s_SetACLs = BitAND(GUICtrlRead($ge_Check_SetACLs), $GUI_CHECKED) $s_Software_YesNo = BitAND(GUICtrlRead($ge_Check_Software), $GUI_CHECKED) $s_DomainJoin_YesNo = BitAND(GUICtrlRead($ge_Check_DomainJoin), $GUI_CHECKED) $s_Restart_YesNo = BitAND(GUICtrlRead($ge_Check_Restart), $GUI_CHECKED) $s_IP = GUICtrlRead($ge_Input_IP) $s_Mask = GUICtrlRead($ge_Input_SM) $s_GW = GUICtrlRead($ge_Input_GW) ; Switch which tasks group to process Switch $s_JobSelected Case $s_JobSelected = $a_arrJOBS[0] GUIDelete() _USERJOBS() _SYSTEMJOBS($s_PWToolsShare, $s_DomSelected, $s_PWDomain, $s_ServicePack_YesNo, $s_RestartAfterWSUS_YesNo, $s_SetACLs, $s_Software_YesNo, $s_DomainJoin_YesNo, $s_Restart_YesNo) Case $s_JobSelected = $a_arrJOBS[1] GUIDelete() _USERJOBS() _NETWORKJOBS($s_ConnSelected, $s_LocSelected, $s_IP, $s_Mask, $s_GW) Case $s_JobSelected = $a_arrJOBS[2] IniWrite($s_IniFile, "Settings", "Interface", $s_ConnSelected) GUIDelete() _USERJOBS() _NETWORKJOBS($s_ConnSelected, $s_LocSelected, $s_IP, $s_Mask, $s_GW) _SYSTEMJOBS($s_PWToolsShare, $s_DomSelected, $s_PWDomain, $s_ServicePack_YesNo, $s_RestartAfterWSUS_YesNo, $s_SetACLs, $s_Software_YesNo, $s_DomainJoin_YesNo, $s_Restart_YesNo) EndSwitch ExitLoop EndSwitch WEnd Could you help me out a bit? Thank you very much in advance of you efforts... Best Regards, Chris Link to comment Share on other sites More sharing options...
rover Posted September 17, 2008 Share Posted September 17, 2008 (edited) Hey Rover, sorry, but I don't seem to get your code working...my GUI looks like this: expandcollapse popup; Main form containing "Task Selection" and "Network Tasks" / "System Tasks" groups $ge_Form_Main = GUICreate("Test D5100 PostInstall", 560, 428, -1, -1) $ge_Label_PWToolsShare = GUICtrlCreateLabel("Password to ""ToolsShare""", 278, 24, 141, 14) $ge_Input_PWToolsShare = GUICtrlCreateInput("", 278, 40, 130, 21, $ES_PASSWORD) Opt("GUICoordMode", 1) ; Create an array containing the selectable tasks and a combobox containing them Local $a_arrJOBS[3] $a_arrJOBS[0] = "System Configuration" $a_arrJOBS[1] = "Network Configuration" $a_arrJOBS[2] = "Network and System Configuration" $ge_Label_Main = GUICtrlCreateLabel("Please choose which tasks to process:", 16, 24, 121, 14) $ge_Combo_Tasks = GUICtrlCreateCombo($a_arrJOBS, 16, 40, 249, 300, 0x0003) For $i=0 To UBound($a_arrJOBS) - 1 GUICtrlSetData($ge_Combo_Tasks, $a_arrJOBS[$i], $a_arrJOBS[0]) Next ; Create the Start-Botton $ge_Buttonstart = GUICtrlCreateButton("Start !", 420, 37, 120, 25, 0) ; Group Network Tasks $ge_NetworkTasksGroup = GUICtrlCreateGroup("Networking", 8, 80, 537, 129) ; Network Connection Selection - Create a list of the network connections existing on the local host $a_ConnectionList = _NWConections($s_OSver) $s_ConnSelected = "" ; Create a combobox containing the network connections $ge_Label_Connection = GUICtrlCreateLabel("Please select the NIC to use:", 16, 102, 200, 17) $ge_Combo_Connection = GUICtrlCreateCombo($a_ConnectionList, 16, 118, 249, 300, 0x0003) For $i = 0 To UBound($a_ConnectionList) - 1 GUICtrlSetData($ge_Combo_Connection, $a_ConnectionList[$i], $a_ConnectionList[0]) Next ; Network Profile Selection - Create a list of network profiles from the .ini-File, 1st, read the "current" settings $s_CurrentProfile = IniRead($s_IniFile, "Settings", "Current", "") ; Create a list of all sections defined in the .ini file and define an array of the ones not being network profiles $a_IniSectionsAll = IniReadSectionNames($s_IniFile) _ArrayDelete($a_IniSectionsAll, 0) Global $a_IniSectionsConfig[4] = ["Settings", "ACL", "ServicePacks", "Users"] Global $a_IniSectionsProfiles = $a_IniSectionsAll ; Sort out the four Non-Network-Profile-Section For $i_i = 0 To UBound($a_IniSectionsConfig) - 1 $i_index = _ArraySearch($a_IniSectionsProfiles, $a_IniSectionsConfig[$i_i], 0, 0, 0, 1) If Not @error Then _ArrayDelete($a_IniSectionsProfiles, $i_index) EndIf Next ; Create a combobox containing the network profiles $ge_Label_NicProfile = GUICtrlCreateLabel("Please select the network profile to use:", 278, 102, 200, 17) $ge_Combo_NicProfile = GUICtrlCreateCombo($a_IniSectionsProfiles, 277, 118, 249, 300, 0x0003) For $i_i = 0 To UBound($a_IniSectionsProfiles) - 1 If $i_i < UBound($a_IniSectionsProfiles) - 1 Then GUICtrlSetData($ge_Combo_NicProfile, $a_IniSectionsProfiles[$i_i]) Else ; Set the running settings as Default GUICtrlSetData($ge_Combo_NicProfile, $a_IniSectionsProfiles[$i_i], $s_CurrentProfile) EndIf Next ; Create input fields for IP-Address, Subnet-Mask and Gateway $ge_Label_IP = GUICtrlCreateLabel("IP-Address (empty = DHCP)", 16, 153, 170, 14) $ge_Input_IP = GUICtrlCreateInput("", 16, 168, 121, 21) $ge_Label_SM = GUICtrlCreateLabel("Subnet-Mask", 216, 153, 150, 21) $ge_Input_SM = GUICtrlCreateInput("", 216, 168, 121, 21) $ge_Label_GW = GUICtrlCreateLabel("Gateway-IP", 416, 153, 100, 14) $ge_Input_GW = GUICtrlCreateInput("", 416, 168, 121, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) ; Group System Tasks $ge_SystemTasksGroup = GUICtrlCreateGroup("System", 8, 224, 537, 193) ; Create a combobox for the Domain membership selection Local $arrDom[4] $arrDom[0] = "Domain A" $arrDom[1] = "Domain B" $arrDom[2] = "Domain C" $arrDom[3] = "Domain D" $ge_Label_DomainToJoin = GUICtrlCreateLabel("Please select a Domain", 17, 248, 130, 17) $ge_Combo_DomainToJoin = GUICtrlCreateCombo($arrDom, 15, 272, 249, 300, 0x0003) For $i = 0 To UBound($arrDom) - 1 GUICtrlSetData($ge_Combo_DomainToJoin, $arrDom[$i], $arrDom[0]) Next ; Create the input field for the domain password $ge_Label_PWDomain = GUICtrlCreateLabel("Password to Domain", 278, 248, 115, 17) $ge_Input_PWDomain = GUICtrlCreateInput("", 278, 272, 130, 21, $ES_PASSWORD) ; Show the icon graphics for the current language $_ge_Label_Language = GUICtrlCreateLabel("Current Language", 432, 248, 90, 17) _GDIPlus_StartUp() Switch $s_KbdRegValue Case "00000407" $_ge_Pic_LanguageDE = GUICtrlCreatePic($s_ScriptHome & "\Tools\german.gif", 432, 272, 90, 60) Case "00000409" $_ge_Pic_LanguageUS = GUICtrlCreatePic($s_ScriptHome & "\Tools\american.gif", 432, 272, 90, 60) Case Else $ge_PNGimage = _GDIPlus_ImageLoadFromFile($s_ScriptHome & "\Tools\other.png") $ge_PNGgraphic = _GDIPlus_GraphicsCreateFromHWND($ge_Form_Main) GUIRegisterMsg($WM_PAINT, "MY_WM_PAINT") $_ge_Pic_LanguageOther = GUICtrlCreatePic($s_ScriptHome & "\Tools\other1.gif", 445, 272, 72, 72) EndSwitch ; Create the checkboxes for the system tasks $ge_Check_ServicePack = GUICtrlCreateCheckbox("ServicePack Installation", 15, 312, 150, 17) $ge_Check_RestartAfterWSUS = GUICtrlCreateCheckbox("Restart After WSUS", 15, 344, 150, 17) $ge_Check_SetACLs = GUICtrlCreateCheckbox("Set compliant ACLs", 15, 376, 150, 17) $ge_Check_Software = GUICtrlCreateCheckbox("Software Installation", 278, 312, 150, 17) $ge_Check_DomainJoin = GUICtrlCreateCheckbox("Join Domain", 278, 344, 150, 17) $ge_Check_Restart = GUICtrlCreateCheckbox("Restart", 278, 376, 150, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE _CloseClicked() Case $ge_Buttonstart ; Return the selected combobox values $s_JobSelected = GUICtrlRead($ge_Combo_Tasks) $s_PWToolsShare = GUICtrlRead($ge_Input_PWToolsShare) $s_ConnSelected = GUICtrlRead($ge_Combo_Connection) $s_LocSelected = GUICtrlRead($ge_Combo_NicProfile) $s_DomSelected = GUICtrlRead($ge_Combo_DomainToJoin) $s_PWDomain = GUICtrlRead($ge_Input_PWDomain) $s_ServicePack_YesNo = BitAND(GUICtrlRead($ge_Check_ServicePack), $GUI_CHECKED) $s_RestartAfterWSUS_YesNo = BitAND(GUICtrlRead($ge_Check_RestartAfterWSUS), $GUI_CHECKED) $s_SetACLs = BitAND(GUICtrlRead($ge_Check_SetACLs), $GUI_CHECKED) $s_Software_YesNo = BitAND(GUICtrlRead($ge_Check_Software), $GUI_CHECKED) $s_DomainJoin_YesNo = BitAND(GUICtrlRead($ge_Check_DomainJoin), $GUI_CHECKED) $s_Restart_YesNo = BitAND(GUICtrlRead($ge_Check_Restart), $GUI_CHECKED) $s_IP = GUICtrlRead($ge_Input_IP) $s_Mask = GUICtrlRead($ge_Input_SM) $s_GW = GUICtrlRead($ge_Input_GW) ; Switch which tasks group to process Switch $s_JobSelected Case $s_JobSelected = $a_arrJOBS[0] GUIDelete() _USERJOBS() _SYSTEMJOBS($s_PWToolsShare, $s_DomSelected, $s_PWDomain, $s_ServicePack_YesNo, $s_RestartAfterWSUS_YesNo, $s_SetACLs, $s_Software_YesNo, $s_DomainJoin_YesNo, $s_Restart_YesNo) Case $s_JobSelected = $a_arrJOBS[1] GUIDelete() _USERJOBS() _NETWORKJOBS($s_ConnSelected, $s_LocSelected, $s_IP, $s_Mask, $s_GW) Case $s_JobSelected = $a_arrJOBS[2] IniWrite($s_IniFile, "Settings", "Interface", $s_ConnSelected) GUIDelete() _USERJOBS() _NETWORKJOBS($s_ConnSelected, $s_LocSelected, $s_IP, $s_Mask, $s_GW) _SYSTEMJOBS($s_PWToolsShare, $s_DomSelected, $s_PWDomain, $s_ServicePack_YesNo, $s_RestartAfterWSUS_YesNo, $s_SetACLs, $s_Software_YesNo, $s_DomainJoin_YesNo, $s_Restart_YesNo) EndSwitch ExitLoop EndSwitch WEndoÝ÷ Û*.綬zØ^vé¦ÉÊ'¶º%ëa¡ØÊ°j{m¢G¦ö«¦åzv¦zÇèæÊ'¶º%{-y§h}©Ú®¶²"·°¢¹w*.®Ç+bÚ¬¨ºÛajØ+¢êl¶¢{k¢[zÜzwnl¢{k¢[-+-jG¬iÛÚÖ zíëªç§¶&¥r·¶*'¡÷(Úèìjëh×6#include <GUIConstantsEX.au3> #include <Constants.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <ComboConstants.au3> ;#include <GDIPlus.au3> Opt("GUICoordMode", 1) ;Opt('MustDeclareVars', 1) ; Main form containing "Task Selection" and "Network Tasks" / "System Tasks" groups $ge_Form_Main = GUICreate("Test D5100 PostInstall", 560, 428, -1, -1) $ge_Label_PWToolsShare = GUICtrlCreateLabel("Password to ""ToolsShare""", 278, 24, 141, 14) $ge_Input_PWToolsShare = GUICtrlCreateInput("", 278, 40, 130, 21, $ES_PASSWORD) ; Create an array containing the selectable tasks and a combobox containing them Local $a_arrJOBS[3] $a_arrJOBS[0] = "System Configuration" $a_arrJOBS[1] = "Network Configuration" $a_arrJOBS[2] = "Network and System Configuration" $ge_Label_Main = GUICtrlCreateLabel("Please choose which tasks to process:", 16, 24, 121, 14) $ge_Combo_Tasks = GUICtrlCreateCombo("", 16, 40, 249, 300, 0x0003) $idCombo = GUICtrlCreateDummy() For $i = 0 To UBound($a_arrJOBS) - 1 GUICtrlSetData($ge_Combo_Tasks, $a_arrJOBS[$i], $a_arrJOBS[0]) Next ; Create the Start-Botton $ge_Buttonstart = GUICtrlCreateButton("Start !", 420, 37, 120, 25, 0) ; all controls to be disabled/enabled as a group must be between the two dummy controls ; Network Controls Group ----------------------------------------------------------------------------------- $id_NTG_Begin = GUICtrlCreateDummy() $ge_NetworkTasksGroup = GUICtrlCreateGroup("Networking", 8, 80, 537, 129) ; Create a combobox containing the network connections $ge_Label_Connection = GUICtrlCreateLabel("Please select the NIC to use:", 16, 102, 200, 17) $ge_Combo_Connection = GUICtrlCreateCombo("", 16, 118, 249, 300, 0x0003) ; Create a combobox containing the network profiles $ge_Label_NicProfile = GUICtrlCreateLabel("Please select the network profile to use:", 278, 102, 200, 17) $ge_Combo_NicProfile = GUICtrlCreateCombo("", 277, 118, 249, 300, 0x0003) ; Create input fields for IP-Address, Subnet-Mask and Gateway $ge_Label_IP = GUICtrlCreateLabel("IP-Address (empty = DHCP)", 16, 153, 170, 14) $ge_Input_IP = GUICtrlCreateInput("", 16, 168, 121, 21) $ge_Label_SM = GUICtrlCreateLabel("Subnet-Mask", 216, 153, 150, 21) $ge_Input_SM = GUICtrlCreateInput("", 216, 168, 121, 21) $ge_Label_GW = GUICtrlCreateLabel("Gateway-IP", 416, 153, 100, 14) $ge_Input_GW = GUICtrlCreateInput("", 416, 168, 121, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) $id_NTG_End = GUICtrlCreateDummy() ; Network Controls Group ----------------------------------------------------------------------------------- ; Group Network Tasks ; Network Connection Selection - Create a list of the network connections existing on the local host ;~ $a_ConnectionList = _NWConections($s_OSver) ;~ $s_ConnSelected = "" ;~ ;~ For $i_i = 0 To UBound($a_IniSectionsProfiles) - 1 ;~ If $i_i < UBound($a_IniSectionsProfiles) - 1 Then ;~ GUICtrlSetData($ge_Combo_NicProfile, $a_IniSectionsProfiles[$i_i]) ;~ Else ;~ ; Set the running settings as Default ;~ GUICtrlSetData($ge_Combo_NicProfile, $a_IniSectionsProfiles[$i_i], $s_CurrentProfile) ;~ EndIf ;~ Next ;~ ;~ For $i = 0 To UBound($a_ConnectionList) - 1 ;~ GUICtrlSetData($ge_Combo_Connection, $a_ConnectionList[$i], $a_ConnectionList[0]) ;~ Next ;~ ;~ ; Network Profile Selection - Create a list of network profiles from the .ini-File, 1st, read the "current" settings ;~ $s_CurrentProfile = IniRead($s_IniFile, "Settings", "Current", "") ;~ ; Create a list of all sections defined in the .ini file and define an array of the ones not being network profiles ;~ $a_IniSectionsAll = IniReadSectionNames($s_IniFile) ;~ _ArrayDelete($a_IniSectionsAll, 0) ;~ Global $a_IniSectionsConfig[4] = ["Settings", "ACL", "ServicePacks", "Users"] ;~ Global $a_IniSectionsProfiles = $a_IniSectionsAll ;~ ; Sort out the four Non-Network-Profile-Section ;~ For $i_i = 0 To UBound($a_IniSectionsConfig) - 1 ;~ $i_index = _ArraySearch($a_IniSectionsProfiles, $a_IniSectionsConfig[$i_i], 0, 0, 0, 1) ;~ If Not @error Then ;~ _ArrayDelete($a_IniSectionsProfiles, $i_index) ;~ EndIf ;~ Next Local $arrDom[4] $arrDom[0] = "Domain A" $arrDom[1] = "Domain B" $arrDom[2] = "Domain C" $arrDom[3] = "Domain D" ; all controls to be disabled/enabled as a group must be between the two dummy controls ; System Controls Group ------------------------------------------------------------------------------------ $id_STG_Begin = GUICtrlCreateDummy() $ge_SystemTasksGroup = GUICtrlCreateGroup("System", 8, 224, 537, 193) ; Create a combobox for the Domain membership selection $ge_Label_DomainToJoin = GUICtrlCreateLabel("Please select a Domain", 17, 248, 130, 17) $ge_Combo_DomainToJoin = GUICtrlCreateCombo($arrDom, 15, 272, 249, 300, 0x0003) ; Create the input field for the domain password $ge_Label_PWDomain = GUICtrlCreateLabel("Password to Domain", 278, 248, 115, 17) $ge_Input_PWDomain = GUICtrlCreateInput("", 278, 272, 130, 21, $ES_PASSWORD) ; Show the icon graphics for the current language $_ge_Label_Language = GUICtrlCreateLabel("Current Language", 432, 248, 90, 17) ; Create the checkboxes for the system tasks $ge_Check_ServicePack = GUICtrlCreateCheckbox("ServicePack Installation", 15, 312, 150, 17) $ge_Check_RestartAfterWSUS = GUICtrlCreateCheckbox("Restart After WSUS", 15, 344, 150, 17) $ge_Check_SetACLs = GUICtrlCreateCheckbox("Set compliant ACLs", 15, 376, 150, 17) $ge_Check_Software = GUICtrlCreateCheckbox("Software Installation", 278, 312, 150, 17) $ge_Check_DomainJoin = GUICtrlCreateCheckbox("Join Domain", 278, 344, 150, 17) $ge_Check_Restart = GUICtrlCreateCheckbox("Restart", 278, 376, 150, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $id_STG_End = GUICtrlCreateDummy() ; System Controls Group ------------------------------------------------------------------------------------ ; Group System Tasks For $i = 0 To UBound($arrDom) - 1 GUICtrlSetData($ge_Combo_DomainToJoin, $arrDom[$i], $arrDom[0]) Next ;~ Switch $s_KbdRegValue ;~ Case "00000407" ;~ $_ge_Pic_LanguageDE = GUICtrlCreatePic($s_ScriptHome & "\Tools\german.gif", 432, 272, 90, 60) ;~ Case "00000409" ;~ $_ge_Pic_LanguageUS = GUICtrlCreatePic($s_ScriptHome & "\Tools\american.gif", 432, 272, 90, 60) ;~ Case Else ;~ _GDIPlus_Startup() ;~ $ge_PNGimage = _GDIPlus_ImageLoadFromFile($s_ScriptHome & "\Tools\other.png") ;~ $ge_PNGgraphic = _GDIPlus_GraphicsCreateFromHWND($ge_Form_Main) ;~ GUIRegisterMsg($WM_PAINT, "MY_WM_PAINT") ;~ $_ge_Pic_LanguageOther = GUICtrlCreatePic($s_ScriptHome & "\Tools\other1.gif", 445, 272, 72, 72) ;~ EndSwitch ;if not using pics as a control you can disable them ;$_ge_Pic_LanguageUS = GUICtrlCreatePic($s_ScriptHome & "\Tools\american.gif", 432, 272, 90, 60) ;GuiCtrlSetState(-1, $GUI_DISABLE) ; Disable Network Group ------------------------- For $i = ($id_NTG_Begin + 1) To ($id_NTG_End - 1) GUICtrlSetState($i, $GUI_DISABLE) Next ;------------------------------------------------ ; catch combobox events GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit ;_CloseClicked() Case $idCombo _CheckCombo() Case $ge_Buttonstart ; Return the selected combobox values $s_JobSelected = GUICtrlRead($ge_Combo_Tasks) $s_PWToolsShare = GUICtrlRead($ge_Input_PWToolsShare) $s_ConnSelected = GUICtrlRead($ge_Combo_Connection) $s_LocSelected = GUICtrlRead($ge_Combo_NicProfile) $s_DomSelected = GUICtrlRead($ge_Combo_DomainToJoin) $s_PWDomain = GUICtrlRead($ge_Input_PWDomain) $s_ServicePack_YesNo = BitAND(GUICtrlRead($ge_Check_ServicePack), $GUI_CHECKED) $s_RestartAfterWSUS_YesNo = BitAND(GUICtrlRead($ge_Check_RestartAfterWSUS), $GUI_CHECKED) $s_SetACLs = BitAND(GUICtrlRead($ge_Check_SetACLs), $GUI_CHECKED) $s_Software_YesNo = BitAND(GUICtrlRead($ge_Check_Software), $GUI_CHECKED) $s_DomainJoin_YesNo = BitAND(GUICtrlRead($ge_Check_DomainJoin), $GUI_CHECKED) $s_Restart_YesNo = BitAND(GUICtrlRead($ge_Check_Restart), $GUI_CHECKED) $s_IP = GUICtrlRead($ge_Input_IP) $s_Mask = GUICtrlRead($ge_Input_SM) $s_GW = GUICtrlRead($ge_Input_GW) ; Switch which tasks group to process Switch $s_JobSelected Case $a_arrJOBS[0] GUIDelete() ;_USERJOBS() ;_SYSTEMJOBS($s_PWToolsShare, $s_DomSelected, $s_PWDomain, $s_ServicePack_YesNo, $s_RestartAfterWSUS_YesNo, $s_SetACLs, $s_Software_YesNo, $s_DomainJoin_YesNo, $s_Restart_YesNo) Case $a_arrJOBS[1] GUIDelete() ;_USERJOBS() ;_NETWORKJOBS($s_ConnSelected, $s_LocSelected, $s_IP, $s_Mask, $s_GW) Case $a_arrJOBS[2] ;IniWrite($s_IniFile, "Settings", "Interface", $s_ConnSelected) GUIDelete() ;_USERJOBS() ;_NETWORKJOBS($s_ConnSelected, $s_LocSelected, $s_IP, $s_Mask, $s_GW) ;_SYSTEMJOBS($s_PWToolsShare, $s_DomSelected, $s_PWDomain, $s_ServicePack_YesNo, $s_RestartAfterWSUS_YesNo, $s_SetACLs, $s_Software_YesNo, $s_DomainJoin_YesNo, $s_Restart_YesNo) EndSwitch ExitLoop EndSwitch WEnd Func _CheckCombo() Local $iSTG = 0, $iNTG = 0, $bSTG_State, $bNTG_State $bSTG_State = BitAND(GUICtrlGetState($id_STG_Begin + 1), $GUI_DISABLE) = $GUI_DISABLE $bNTG_State = BitAND(GUICtrlGetState($id_NTG_Begin + 1), $GUI_DISABLE) = $GUI_DISABLE Switch GUICtrlRead($ge_Combo_Tasks) Case $a_arrJOBS[0] ; "System Configuration" If $bSTG_State Then $iSTG = $GUI_ENABLE If Not $bNTG_State Then $iNTG = $GUI_DISABLE Case $a_arrJOBS[1] ; "Network Configuration" If $bNTG_State Then $iNTG = $GUI_ENABLE If Not $bSTG_State Then $iSTG = $GUI_DISABLE Case $a_arrJOBS[2] ; "Network and System Configuration" If $bSTG_State Then $iSTG = $GUI_ENABLE If $bNTG_State Then $iNTG = $GUI_ENABLE EndSwitch If $iSTG Then For $i = ($id_STG_Begin + 1) To ($id_STG_End - 1) GUICtrlSetState($i, $iSTG) Next EndIf If $iNTG Then For $i = ($id_NTG_Begin + 1) To ($id_NTG_End - 1) GUICtrlSetState($i, $iNTG) Next EndIf EndFunc Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg Local $hWndFrom, $iIDFrom, $iCode, $hWndCombo $hWndFrom = $ilParam $iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word $iCode = BitShift($iwParam, 16) ; Hi Word $hWndCombo = GUICtrlGetHandle($ge_Combo_Tasks) Switch $hWndFrom Case $hWndCombo Switch $iCode Case $CBN_CLOSEUP ; Sent when the list box of a combo box has been closed ;GUICtrlSendToDummy($idCombo) Case $CBN_SELCHANGE ; Sent when the user changes the current selection in the list box of a combo box GUICtrlSendToDummy($idCombo) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Edited September 17, 2008 by rover I see fascists... Link to comment Share on other sites More sharing options...
cherdeg Posted September 19, 2008 Author Share Posted September 19, 2008 Hey Rover, sorry I didn't answer yet...yesterday I implemented the relevant lines of your code into my version...and it works just perfect!!! YOU'RE THE MAN!!! Thank you very much for saving my time (and brains) Could I help you out with something in Return? Best Regards, Chris Link to comment Share on other sites More sharing options...
rover Posted September 20, 2008 Share Posted September 20, 2008 Hey Rover,sorry I didn't answer yet...yesterday I implemented the relevant lines of your code into my version...and it works just perfect!!!YOU'RE THE MAN!!!Thank you very much for saving my time (and brains) Could I help you out with something in Return?Best Regards,Chrisno problem Chrisglad to help out with reducing your work related stress. >_< Could I help you out with something in Return?if you can, help out with answering questions in the forum every now and then.be seeing you...(its a departing line from a TV series that's on most TV critics all time favourite list, right up there with 'Edge of Darkness' and 'The Singing Detective' (tv, not the movie)) I see fascists... Link to comment Share on other sites More sharing options...
cherdeg Posted February 26, 2009 Author Share Posted February 26, 2009 Sorry all to *bump* this ancient topic again... ...but I currently have to go over and optimize the code I produced back then. One optimization was to change the three input-fields for IP-Addresses from "GUICtrlCreateInput" to "_GUICtrlIpAddress_Create". But now the won't grey out any longer... Does anybody have a clue, why? Every help is greatly appreciated; Thank you in anticipation of any efforts... Regards, Chris Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 27, 2009 Moderators Share Posted February 27, 2009 cherdeg,I do not think you can "grey-out" that type of control. It does not respond to GUICtrlSetState as you have discovered. But you can "show/hide" it using _GUICtrlIpAddress_ShowHide - the following code replaces the IpAdrress control with a "greyed-out" edit which holds the same data as the hidden IpAddress control:#include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <GuiIPAddress.au3> Global $fState = True, $hEdit_Grey = 9999 $hGUI = GUICreate("Test", 200, 200) $hIP = _GUICtrlIpAddress_Create($hGUI, 10, 10, 100, 20) $test = GUICtrlCreateButton("Toggle", 10, 50, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $test $fState = Not $fState _GUICtrlIpAddress_ShowHide($hIP, $fState) If $fState = False Then $sIP = _GUICtrlIpAddress_Get($hIP) $hEdit_Grey = GUICtrlCreateEdit($sIP, 10, 10, 100, 20) GUICtrlSetState(-1, $GUI_DISABLE) Else GUICtrlDelete($hEdit_Grey) EndIf EndSwitch WEndI know that this is not perfect, but I hope that it helps.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
cherdeg Posted March 2, 2009 Author Share Posted March 2, 2009 (edited) [...] but I hope that it helps. It probably does, but I don't seem being able to get it into my code. But the change to using _GUICtrlIpAddress_Create instead of a simple GUICtrlCreateInput is definitely a minor issue. In my understanding, the function checkcombo() and WM_COMMAND do the switching in my current GUI. Due to the fact that checkcombo() switches the different cases, It seemed senseful for me to try and use your code there, I only used this part: $fState = Not $fState _GUICtrlIpAddress_ShowHide($hIP, $fState) If $fState = False Then $sIP = _GUICtrlIpAddress_Get($hIP) $hEdit_Grey = GUICtrlCreateEdit($sIP, 10, 10, 100, 20) GUICtrlSetState(-1, $GUI_DISABLE) Else GUICtrlDelete($hEdit_Grey) EndIf ...and replaced $fState with my variables $bSTG_State and $bNTG_State and also $hIP with the three from my GUI. But I couldn't get it to work in about two hours (probably a lack of understanding on my side), so I quit that part for the moment. But if there is time to waste some day, I'll return back on this. Never the less: Thank you very much for your definitely working code... Regards, Chris Edited March 2, 2009 by cherdeg Link to comment Share on other sites More sharing options...
rover Posted March 7, 2009 Share Posted March 7, 2009 @cherdeg use the ControlEnable/Disable commands with returned handle from _GUICtrlIpAddress_Create() #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <GuiIPAddress.au3> Global $fState = True, $hEdit_Grey = 9999 $hGUI = GUICreate("Test", 200, 200) $hIP = _GUICtrlIpAddress_Create($hGUI, 10, 10, 100, 20) _GUICtrlIpAddress_Set ($hIP, "24.168.2.128") $test = GUICtrlCreateButton("Toggle", 10, 50, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $test $fState = Not $fState If $fState = False Then ControlDisable($hGUI, "", $hIP) Else ControlEnable($hGUI, "", $hIP) EndIf EndSwitch WEnd I see fascists... Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 7, 2009 Moderators Share Posted March 7, 2009 rover,An obvious solution when you know it exists!I had never noticed the ControlDisable/Enable commands. An example of the Help file being "too big" sometimes - not that I am complaining, of course. ;-)M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
rover Posted March 7, 2009 Share Posted March 7, 2009 rover,An obvious solution when you know it exists!I had never noticed the ControlDisable/Enable commands. An example of the Help file being "too big" sometimes - not that I am complaining, of course. ;-)M23@Melba23for me, its about solutions, not victories.I think we all miss new commands or ones we've never used or forgot about.does anyone have the entire Win32 API committed to memory? (but that's obsolete now isn't it?, with .NET etc.)I recall a comment or lament by weaponx about the lack of a help file as comprehensive as AutoIt's for the C languages.we are fortunatebe seeing you. I see fascists... Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 7, 2009 Moderators Share Posted March 7, 2009 rover, I entirely share your feelings on this. Please do not take my earlier remarks as anything other than delight that the command exists - it was certainly not made in any other sense. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
rover Posted March 8, 2009 Share Posted March 8, 2009 rover,I entirely share your feelings on this. Please do not take my earlier remarks as anything other than delight that the command exists - it was certainly not made in any other sense.M23no offense taken, was just amiable banter on my part.I was PM'ed by cherdeg about this and only got back to it now.Cheers I see fascists... Link to comment Share on other sites More sharing options...
cherdeg Posted March 9, 2009 Author Share Posted March 9, 2009 I was PM'ed by cherdeg about this and only got back to it now. CheersHey rover, thank you very much: once again you made my day (and that, taking in the fact that today is one of "my most beloved" Mondays, happens very sparsely). After failing to get Melba's working code into my crap, I succeeded using yours in about..mom..16 minutes (Melba: please don't take it as an offence, the problem was my ability, not your code ). I simply adjusted the variable names to match mine, set the controls disabled by default (why? see comment): CODE; Disable the Network Tasks Group (the System Tasks Group is the default of the combobox, therefore the Network Tasks Group must start up disabled) For $i = ($id_NTG_Begin + 1) To ($id_NTG_End - 1) GUICtrlSetState($i, $GUI_DISABLE) Next ControlDisable($ge_Form_Main, "", $ge_Input_IP) ControlDisable($ge_Form_Main, "", $ge_Input_SM) ControlDisable($ge_Form_Main, "", $ge_Input_GW) ...and entered the above three lines into the existing function _CheckCombo($a_arrJOBS, $ge_Input_IP, $ge_Input_SM, $ge_Input_GW) which now of course no longer needs only the array but also the control handles. The function now looks like this: expandcollapse popup; Function _CheckCombo to check the current value of combobox $ge_Combo_Tasks and switches the task groups on and off ; ================================================================================================== Func _CheckCombo($a_arrJOBS, $ge_Input_IP, $ge_Input_SM, $ge_Input_GW) Local $iSTG = 0, $iNTG = 0, $bSTG_State, $bNTG_State $bSTG_State = BitAND(GUICtrlGetState($id_STG_Begin + 1), $GUI_DISABLE) = $GUI_DISABLE $bNTG_State = BitAND(GUICtrlGetState($id_NTG_Begin + 1), $GUI_DISABLE) = $GUI_DISABLE Switch GUICtrlRead($ge_Combo_Tasks) Case $a_arrJOBS[0] ; "System Configuration" If $bSTG_State Then $iSTG = $GUI_ENABLE EndIf If Not $bNTG_State Then $iNTG = $GUI_DISABLE ControlDisable($ge_Form_Main, "", $ge_Input_IP) ControlDisable($ge_Form_Main, "", $ge_Input_SM) ControlDisable($ge_Form_Main, "", $ge_Input_GW) EndIf Case $a_arrJOBS[1] ; "Network Configuration" If $bNTG_State Then $iNTG = $GUI_ENABLE ControlEnable($ge_Form_Main, "", $ge_Input_IP) ControlEnable($ge_Form_Main, "", $ge_Input_SM) ControlEnable($ge_Form_Main, "", $ge_Input_GW) EndIf If Not $bSTG_State Then $iSTG = $GUI_DISABLE EndIf Case $a_arrJOBS[2] ; "Network and System Configuration" If $bSTG_State Then $iSTG = $GUI_ENABLE ControlEnable($ge_Form_Main, "", $ge_Input_IP) ControlEnable($ge_Form_Main, "", $ge_Input_SM) ControlEnable($ge_Form_Main, "", $ge_Input_GW) EndIf If $bNTG_State Then $iNTG = $GUI_ENABLE ControlEnable($ge_Form_Main, "", $ge_Input_IP) ControlEnable($ge_Form_Main, "", $ge_Input_SM) ControlEnable($ge_Form_Main, "", $ge_Input_GW) EndIf EndSwitch If $iSTG Then For $i = ($id_STG_Begin + 1) To ($id_STG_End - 1) GUICtrlSetState($i, $iSTG) Next EndIf If $iNTG Then For $i = ($id_NTG_Begin + 1) To ($id_NTG_End - 1) GUICtrlSetState($i, $iNTG) Next EndIf EndFunc ;==>_CheckCombo So in the end I would like to thank the both of you very much! Best Regards, Chris 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