airrs Posted July 13, 2012 Share Posted July 13, 2012 (edited) Hi there, i've got a problem with the radio buttons. i have a gui with 3 radio buttons and a normal button. if you select radio button 1 an click on the button, the main window should close and window 1 should open (radio utton 2 window 2 and so on) another problem: the program open and close in less than a sec. Sleep, doesn't work out here my source codeexpandcollapse popup#include $mainWin = "" $test1 = "" $test2 = "" $test3 = "" $rbN = "" ;Hauptfenster $mainWin = GUICreate("Neuer Account",190,150) GUICtrlCreateGroup("Auswahl",20,10,150,95) GUIStartGroup() $rb1 = GUICtrlCreateRadio("Station",40,25) $rb2 = GUICtrlCreateRadio("Agent",40,50) $rb3 = GUICtrlCreateRadio("Search and Replay",40,75) $rb4 = GUICtrlCreateGroup("", -99, -99, 1, 1) ;gruppe schließen $btn = GUICtrlCreateButton("Weiter",80,115) ;FENSTER 1 $test1 = GUICreate("testfenster",190,150) GUICtrlCreateGroup("11",20,10,150,95) GUIStartGroup() $rb = GUICtrlCreateRadio("12",40,25) $rb = GUICtrlCreateRadio("13",40,50) $rb = GUICtrlCreateRadio("14",40,75) $rb = GUICtrlCreateGroup("", -99, -99, 1, 1) ;gruppe schließen $btn2 = GUICtrlCreateButton("Zurück",80,115) ... ... ... GUISetState(@SW_SHOW,$mainWin) While 1 $msg = GUIGetMsg(1) GuiCtrlRead($rb1, $GUI_CHECKED) GuiCtrlRead($rb2, $GUI_CHECKED) Switch $msg[1] Case $mainWin Switch $msg[0] Case $GUI_EVENT_CLOSE Exit Case $btn If $msg = $rb1 And BitAND(GUICtrlRead($rb1), $GUI_CHECKED) = $GUI_CHECKED Then GUISetState(@SW_HIDE,$mainWin) GUISetState(@SW_Show,$test1) ElseIf $msg = $rb2 And BitAND(GUICtrlRead($rb2), $GUI_CHECKED) = $GUI_CHECKED Then GUISetState(@SW_HIDE,$mainWin) GUISetState(@SW_Show,$test2) EndIf EndSwitch Case $test1 Switch $msg[0] Case $btn2 GUISetState(@SW_Show,$mainWin) GUISetState(@SW_HIDE,$test1) Case $GUI_EVENT_CLOSE Exit EndSwitch EndSwitch WEnd I hope you're able to help me. Edited August 29, 2012 by airrs Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 13, 2012 Moderators Share Posted July 13, 2012 airrs, Welcome to the AutoIt forum. You were making the conditions too strict for the action to occur - try something like this: expandcollapse popup#include <GUIConstantsEx.au3> $mainWin = "" $test1 = "" $test2 = "" $test3 = "" $rbN = "" ;Hauptfenster $mainWin = GUICreate("Neuer Account", 190, 150) GUICtrlCreateGroup("Auswahl", 20, 10, 150, 95) GUIStartGroup() $rb1 = GUICtrlCreateRadio("Station", 40, 25) $rb2 = GUICtrlCreateRadio("Agent", 40, 50) $rb3 = GUICtrlCreateRadio("Search and Replay", 40, 75) $rb4 = GUICtrlCreateGroup("", -99, -99, 1, 1) ;gruppe schließen $btn = GUICtrlCreateButton("Weiter", 80, 115) GUISetState(@SW_SHOW, $mainWin) ;FENSTER 1 $test1 = GUICreate("testfenster1", 190, 150) $btn1 = GUICtrlCreateButton("Zurück", 80, 115) GUISetState(@SW_HIDE) ;FENSTER 2 $test2 = GUICreate("testfenster2", 190, 150) $btn2 = GUICtrlCreateButton("Zurück", 80, 115) GUISetState(@SW_HIDE) While 1 $msg = GUIGetMsg(1) Switch $msg[1] Case $mainWin Switch $msg[0] Case $GUI_EVENT_CLOSE Exit Case $btn If GUICtrlRead($rb1) = 1 Then ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< GUISetState(@SW_HIDE, $mainWin) GUISetState(@SW_SHOW, $test1) Else GUISetState(@SW_HIDE, $mainWin) GUISetState(@SW_SHOW, $test2) EndIf EndSwitch Case $test1 Switch $msg[0] Case $btn1 GUISetState(@SW_SHOW, $mainWin) GUISetState(@SW_HIDE, $test1) Case $GUI_EVENT_CLOSE Exit EndSwitch Case $test2 Switch $msg[0] Case $btn2 GUISetState(@SW_SHOW, $mainWin) GUISetState(@SW_HIDE, $test2) Case $GUI_EVENT_CLOSE Exit EndSwitch EndSwitch WEnd All 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...
airrs Posted July 13, 2012 Author Share Posted July 13, 2012 Thank you. You saved my day 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