zotchy Posted July 5, 2011 Share Posted July 5, 2011 Hello everybody, I would like to ask you for help. I have a simple application which has a list with items, several radio buttons and button starting the explorer. This is what I need to have: When I select some item in the list, I need Radio buttons changed. For example: when I press on item "3" I need several new radio buttons appear below of first ones. And If I select another item after that new radios will disappear. This is the script: expandcollapse popup#include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) Navigator() Func Navigator() Local $hGUI1, $menu1, $n1, $radioPROD, $n3, $n4, $radioUAT, $radioMARKET, $radioINTERFACE,$radioPROD_RUS1, $radioPROD_RUS2, $radioPROD_RUS3, $radioPROD_RUS6,$hGUI2, $msg, $msg2, $srv, $menustate, $menutext, $widthCell, $server $hGUI1 = GUICreate("Navigator") $n1 = GUICtrlCreateList("", 10, 10, -1, 300) GUICtrlSetData(-1, "1|2|3", "item2") $widthCell = 200 GUICtrlCreateLabel("Radios", 220, 10, $widthCell) $radioPROD = GUICtrlCreateRadio("PROD", 220, 25, 50, 20) $radioUAT = GUICtrlCreateRadio("UAT", 300, 25, 100, 20) $n3 = GUICtrlCreateButton("Open", 10, 310, 50) GUICtrlSetState(-1, $GUI_FOCUS) GUISetState() Do $msg = GUIGetMsg() If $msg = $n3 and GUICtrlRead($radioPROD) = 1 and GUICtrlRead($n1) = '1' Then Run("explorer.exe \\swigva01-srv125\siebsrvr1\DOCKING") EndIf If $msg = $n3 and GUICtrlRead($radioPROD) = 1 and GUICtrlRead($n1) = '2' Then Run("explorer.exe \\swigva01-srv120\siebsrvr1\DOCKING") EndIf If $msg = $n3 and GUICtrlRead($radioPROD) = 1 and GUICtrlRead($n1) = '3' Then Run("explorer.exe \\swigva01-srv120\siebsrvr1\DOCKING") EndIf Until $msg = $GUI_EVENT_CLOSE EndFunc Thank you in advanse. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 5, 2011 Moderators Share Posted July 5, 2011 zotchy,Welocme the the AutoIt forum. I suggest you create all the radios you need when you create the GUI and thne use $GUI_HIDE/SHOW as required. This modified version of your script shows you the idea:expandcollapse popup#include <GUIConstantsEx.au3> Navigator() Func Navigator() $hGUI1 = GUICreate("Navigator") $n1 = GUICtrlCreateList("", 10, 10, -1, 300) GUICtrlSetData(-1, "1|2|3", "item2") $widthCell = 200 GUICtrlCreateLabel("Radios", 220, 10, $widthCell) $radioPROD = GUICtrlCreateRadio("PROD", 220, 25, 50, 20) $radioUAT = GUICtrlCreateRadio("UAT", 300, 25, 100, 20) $radio_Extra_1 = GUICtrlCreateRadio("Extra 1", 220, 55, 80, 20) GUICtrlSetState(-1, $GUI_HIDE) $radio_Extra_2 = GUICtrlCreateRadio("Extra 1", 300, 55, 80, 20) GUICtrlSetState(-1, $GUI_HIDE) $n3 = GUICtrlCreateButton("Open", 10, 310, 50) GUICtrlSetState(-1, $GUI_FOCUS) GUISetState() Do $msg = GUIGetMsg() If $msg = $n3 and GUICtrlRead($radioPROD) = 1 and GUICtrlRead($n1) = '1' Then Run("explorer.exe \\swigva01-srv125\siebsrvr1\DOCKING") EndIf If $msg = $n3 and GUICtrlRead($radioPROD) = 1 and GUICtrlRead($n1) = '2' Then Run("explorer.exe \\swigva01-srv120\siebsrvr1\DOCKING") EndIf If $msg = $n3 and GUICtrlRead($radioPROD) = 1 and GUICtrlRead($n1) = '3' Then Run("explorer.exe \\swigva01-srv120\siebsrvr1\DOCKING") EndIf If $msg = $n1 Then If GUICtrlRead($n1) = "3" Then GUICtrlSetState($radio_Extra_1, $GUI_SHOW) GUICtrlSetState($radio_Extra_2, $GUI_SHOW) Else GUICtrlSetState($radio_Extra_1, $GUI_HIDE) GUICtrlSetState($radio_Extra_2, $GUI_HIDE) EndIf EndIf Until $msg = $GUI_EVENT_CLOSE EndFuncAll clear? 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...
zotchy Posted July 5, 2011 Author Share Posted July 5, 2011 Dear Melba23, Thank you very much for your reply. This is what I need. Only one thing I faced. When I add 2 extra hidden buttons, only two are visible. Very strange because I checked the location parameters several times. Seems that it touched only hidden buttons, because I am able to add several which is visible from the start of application. Thank you in advance and sorry for such elementary questions. I am newbie. 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