Jump to content

Search the Community

Showing results for tags 'onevent mode'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. My program displays a list of "house rules" in a form, provides a checkbox for the user to agree to the rules, asks for the user's first and last name, and allows the user to either Cancel (bail out and log off) or OK it and continue on. I'm using OnEvent Mode to process the user's response to the form. As you'll see in the comments below I can't figure out how to return to the main body of my program after the user clicks the OK button. #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 ; remember that when the above is enabled all variables declared within the Program region must be Global. #Region - Main Body (or at least I'd like it to be!) Opt("GUIOnEventMode", 1) Global $Form1, $idInput1, $idInput2, $Button2, $sFN, $sLN _DisplayForm() ; display agreement form ; next step in program (if I can get back here) MsgBox($MB_SYSTEMMODAL, "Results", "returned to main body") Exit #EndRegion - Main Body #Region - Functions Func _DisplayForm() $Form1 = GUICreate("Form1", 679, 438, 192, 124) ; ask firstname $idInput1 = GUICtrlCreateInput("", 56, 360, 169, 21) ; ask lastname $idInput2 = GUICtrlCreateInput("", 240, 360, 177, 21) ; add labels GUICtrlCreateLabel("Enter first name", 56, 336, 77, 17) GUICtrlCreateLabel("Enter last name", 240, 336, 77, 17) GUICtrlCreateLabel("I agree", 480, 336, 37, 17) ; checkbox for agreement GUICtrlCreateCheckbox("Checkbox1", 456, 336, 17, 17) GUICtrlSetOnEvent(-1, "Checkbox1Click") ; allow bail out GUICtrlCreateButton("Cancel", 464, 368, 73, 33) GUICtrlSetOnEvent(-1, "_CancelPressed") ; OK available only if checkbox checked $Button2 = GUICtrlCreateButton("Okay", 560, 368, 81, 33) GUICtrlSetOnEvent(-1, "_OKPressed") GUICtrlSetState($Button2, $GUI_DISABLE) GUISetState(@SW_SHOW) While 1 Sleep(100) WEnd EndFunc ;==>_DisplayForm Func _CancelPressed() MsgBox($MB_SYSTEMMODAL, "Results", "Cancel pressed") Exit ; if no agreement then exit EndFunc ;==>_CancelPressed Func _OKPressed() ; THIS IS THE FUNCTION FROM WHICH I NEED TO RETURN TO MAIN BODY $sFN = GUICtrlRead($idInput1) $sLN = GUICtrlRead($idInput2) MsgBox($MB_SYSTEMMODAL, "Results", "firstname: " & $sFN & @CRLF & "lastname: " & $sLN) ; HOW DO I RETURN TO THE MAIN PROGRAM BODY? ; Return just takes me back to _DisplayForm instead of the main prog ; Setting a variable here and checking for it in _DisplayForm's While/WEnd loop doesn't work either EndFunc ;==>_OKPressed Func Checkbox1Click() GUICtrlSetState($Button2, $GUI_ENABLE) EndFunc ;==>Checkbox1Click #EndRegion - Functions I've Googled the topic of exiting a function early but have found nothing applicable to my situation. I even tried the techniques from this old post, to no avail. I have rewritten the form code using MessageLoop Mode, so I have a Plan B, but am curious if there's a solution.
×
×
  • Create New...