emog Posted March 20, 2007 Posted March 20, 2007 (edited) How do I make it so that when the "Preset" radio button is selected Sub Options 1 & 2 remain selectable, but the X1/Y1, X2/Y2 edit boxes become ghosted? And, similarly, when the "Custom" radio button is enabled the X1/Y1, X2/Y2 edit boxes become editable, but Sub Option 1 & 2 checkboxes become ghosted?Lastly, how do I make it so that the states of the buttons/boxes are only read and acted upon when the large "Submit" button is pressed?Here's my current code (generated with GuiBuilder).expandcollapse popup#include <GuiConstants.au3> $GUI_Handle = GuiCreate("Control Panel", 280, 490,(@DesktopWidth-280)/2, (@DesktopHeight-490)/2) $Button_1 = GuiCtrlCreateButton("Submit", 90, 430, 120, 50) GUICtrlSetFont(-1,9,700,4,"MS Sans Serif") $Group_2 = GuiCtrlCreateGroup("Box 2", 10, 190, 260, 160) GUICtrlSetStyle(-1,BitOR($BS_GROUPBOX,0,$BS_MULTILINE)) $Group_3 = GuiCtrlCreateGroup("Box 1", 10, 70, 260, 100) $Checkbox_4 = GuiCtrlCreateCheckbox("Optional 1", 60, 100, 160, 20) GUICtrlSetStyle(-1,BitOR(0,0,$BS_AUTOCHECKBOX,0,$BS_MULTILINE)) $Checkbox_5 = GuiCtrlCreateCheckbox("Optional 2", 60, 130, 160, 20) GUICtrlSetState(-1, $GUI_CHECKED) $Radio_6 = GuiCtrlCreateRadio("Preset", 40, 210, 100, 30) GUICtrlSetState(-1, $GUI_CHECKED) $Radio_7 = GuiCtrlCreateRadio("Custom", 41, 274, 100, 30) $Checkbox_8 = GuiCtrlCreateCheckbox("Sub option 1", 150, 215, 90, 20) GUICtrlSetState(-1, $GUI_CHECKED) $Checkbox_9 = GuiCtrlCreateCheckbox("Sub option 2", 150, 242, 90, 20) $Group_10 = GuiCtrlCreateGroup("Sound", 10, 360, 260, 55) $Checkbox_11 = GuiCtrlCreateCheckbox("Beep when done?", 80, 380, 130, 20) $Input_12 = GuiCtrlCreateInput("", 160, 280, 35, 20) $Input_13 = GuiCtrlCreateInput("", 195, 280, 35, 20) $Input_14 = GuiCtrlCreateInput("", 160, 310, 35, 20) $Input_15 = GuiCtrlCreateInput("", 195, 310, 35, 20) $Treeview_16 = GuiCtrlCreateTreeview(60, 80, 1, 1) $Label_18 = GuiCtrlCreateLabel(" Program Title", 66, 11, 160, 20) $Label_19 = GuiCtrlCreateLabel("© 2007 Joe Bloggs", 87, 36, 130, 20) $Label_20 = GuiCtrlCreateLabel("X1, Y1", 118, 280, 40, 20) $Label_21 = GuiCtrlCreateLabel("X2, Y2", 118, 311, 40, 20) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;; EndSelect WEndI don't currently have any code to deal with the controllers yet, am just trying to get my head around it all first.Thanks[Edit: I do apologise, I thought I was in the GUI sub-section of the forum (had loads of windows open from forum search results). I can't see where to delete the topic, could a mod perhaps move it, please? Thanks] Edited March 20, 2007 by emog
vrocco Posted March 20, 2007 Posted March 20, 2007 I am pretty new to this, but I like using the "GUIOnEventMode". Koda will generate code for OnEvent. Then use the "Click" events to disable the options you want to: i.e. You click on Preset Radio and it uses GuiCtrlSetState to Disable X1,Y1, etc. That's how I made mine. Hope it helps a bit.
Eru Posted March 20, 2007 Posted March 20, 2007 (edited) Try adding some cases to your while loop to detect when the button is selected, and disable stuff according to it. example: 2 options, A and B, each has 2 sub options, A1/A2 & B1/B2 Case $Action = $A And GUICtrlRead($A) = $GUI_CHECKED GUICtrlSetState($A1, $GUI_ENABLE) GUICtrlSetState($A2, $GUI_ENABLE) GUICtrlSetState($B1, $GUI_DISABLE) GUICtrlSetState($B2, $GUI_DISABLE) edit: oops didn't add a case for $B being clicked, but it's the same idea. Edited March 20, 2007 by Eru
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