Jump to content
Sign in to follow this  
DigDeep

MsgBox Yes/No

Recommended Posts

DigDeep

Hi,

Not sure why it is not working here.

Everything else works good, except if I want to perform any of the actions (Say Step 1) then it should give me a msgbox first to proceed or not.

The code works for Step 1 but I am not getting that msgbox prior to that.

Also if I select NO then I just want the msgBox to close. Not the complete code.

Could you please help here.

 

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 388, 241, 750, 360)
$Step1 = GUICtrlCreateLabel("Step 1", 32, 40, 42, 20)
$Step2 = GUICtrlCreateLabel("Step 3", 216, 40, 42, 20)
$Step3 = GUICtrlCreateLabel("Step 2", 120, 40, 42, 20)
$Step4 = GUICtrlCreateLabel("Step 4", 312, 40, 42, 20)
$Input_Text = GUICtrlCreateInput("", 48, 104, 289, 24)
$OK = GUICtrlCreateButton("OK", 152, 176, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    $aInfo = GUIGetCursorInfo($Form1)
    If $aInfo[2] Then
        If $aInfo[4] = $Input_Text Then GUICtrlSetData($Input_Text, "")
    EndIf

    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit


        Case $OK
            Select
                Case GUICtrlRead($Input_Text) = '1'
                $verify = MsgBox(68, "", "Do you want to proceed with Step 1?")
                    Select
                        Case $verify = '6'
                            Exit
                        Case $verify = '7'
                            ; Cancel Exit
                    EndSelect
                    Msgbox(0,"","step1")

                Case GUICtrlRead($Input_Text) = '2'
                    Msgbox(0,"","step2")

                Case GUICtrlRead($Input_Text) = '3'
                    Msgbox(0,"","step3")

                Case GUICtrlRead($Input_Text) = '4'
                    Msgbox(0,"","step4")
            EndSelect

    EndSwitch
WEnd

 

Share this post


Link to post
Share on other sites
ajag

$verify = MsgBox(68, "", "Do you want to proceed with Step 1?")
                    Select
                        Case $verify = 6
                            ; YES, proceed with step 1
                            Msgbox(0,"","step1")
                        Case $verify = 7
                            ; NO thanks
                    EndSelect

 

Or simplier

If MsgBox(68, "", "Do you want to proceed with Step 1?") = 6 Then
                          Msgbox(0,"","step1")
                    EndIf

Ajag


Rule #1: Always do a backup         Rule #2: Always do a backup (backup of rule #1)

Share this post


Link to post
Share on other sites
DigDeep

thanks, by the time I refreshed this page I already figured out. :)

Thank you again.

Share this post


Link to post
Share on other sites
DigDeep

I used something like this....

$verify = MsgBox(68, "", "Do you want to proceed with Step 1?")
                    Select
                        Case $verify = '6'
                            ; Cancel Exit
                        Case $verify = '7'
                            Continueloop
                    EndSelect
                    Msgbox(0,"","step1")

 

Share this post


Link to post
Share on other sites
ViciousXUSMC

When you only want the one thing you can even one line it.

 

If MsgBox(4, "", "My Text Question") = 6 Then MsgBox(0, "", "You Clicked Yes")

Share this post


Link to post
Share on other sites
JLogan3o13

Or...

$firstQuestion = MsgBox(4, "", "My Test Question")
$answer = MsgBox(0, "", ($firstQuestion = 6) ? "You clicked Yes" : "You clicked No")

 


√-1 2^3 ∑ π, and it was delicious!

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  

×