YoshiKlarenbeek Posted December 12, 2012 Share Posted December 12, 2012 Once the user presses retry the MsgBox should close and you should be able to change stuff, but as of yet the whole program closes? Ps. Here a part of the code. Func _GUI() GUISetState(@SW_SHOW, $main) While 1 ;~ = true $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $btnManual $varElectosVersion = GUICtrlRead($hCombo) $varElectosVersionDash = StringReplace($varElectosVersion,".","-") ;Replaces the . for a - for use in the .sws and .ws. MsgBox(0,"varElectosVersion",$varElectosVersion) If $varElectosVersion = "" Then $RetryCancel = MsgBox(48 + 5, "Electos Version", "Error, please select an Electos version.") Switch $RetryCancel Case 4 ;Retry Return Case 2 ;Cancel Exit EndSwitch EndIf Tell me if you need more info. Link to comment Share on other sites More sharing options...
YoshiKlarenbeek Posted December 12, 2012 Author Share Posted December 12, 2012 Fixed by replacingCase 4 ;RetryReturnforCase 4 ;Retry_GUI() Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 12, 2012 Moderators Share Posted December 12, 2012 YoshiKlarenbeek,That is most certainly NOT the answer as you start an infinite recursive loop by recalling the function inside itself. Read the Recursion tutorial in the Wiki to understand why this is a bad thing. All you need to do is to simply ignore that return value - then you return to the main loop and wait for another button press: #include <GUIConstantsEx.au3> _GUI() Func _GUI() $main = GUICreate("Test", 500, 500) $hCombo = GUICtrlCreateCombo("", 10, 10, 200, 20) GUICtrlSetData(-1, "1.1|1.2|1.3") $btnManual = GUICtrlCreateButton("Go", 10, 200, 80, 30) GUISetState(@SW_SHOW, $main) While 1 ;~ = true $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $btnManual $varElectosVersion = GUICtrlRead($hCombo) $varElectosVersionDash = StringReplace($varElectosVersion, ".", "-") ;Replaces the . for a - for use in the .sws and .ws. MsgBox(0, "varElectosVersion", $varElectosVersion) If $varElectosVersion = "" Then $RetryCancel = MsgBox(48 + 5, "Electos Version", "Error, please select an Electos version.") Switch $RetryCancel Case 2 ;Cancel Exit EndSwitch EndIf EndSelect WEnd EndFunc ;==>_GUIAll 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...
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