Sign in to follow this  
Followers 0
YoshiKlarenbeek

MsgBox Retry Cancel bug?

3 posts in this topic

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.

Share this post


Link to post
Share on other sites



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   ;==>_GUI

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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0