Jump to content

Open file menu while script in progress.


Recommended Posts

I have a GUI with loads of functions, buttons, tabs in it. When any function is in progress, I cannot click on the file, about, help tab menus to launch the options unless the functions have completed.

I was wondering if there is a way that I can still launch the options from file menus when a work is in progress.

Link to comment
Share on other sites

When you're inside another loop than the main loop (the one that receives user inputs from your gui) you can't get those inputs, to circumvent that issue you have to use events, what I usually do is this:

 

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $Flag = 1
#Region ### START Koda GUI section ### Form=
$Form1_1 = GUICreate("TEST", 202, 65, 192, 124)
$Button1 = GUICtrlCreateButton("Button", 64, 32, 75, 25)
$Checkbox1 = GUICtrlCreateCheckbox("OnEvent", 120, 8, 65, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    If GUICtrlRead($Checkbox1) = $GUI_CHECKED And $Flag Then LOOP()
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            MsgBox(64,"MSG","NORMAL")
    EndSwitch
WEnd


Func LOOP()
    $Flag = 0
    Opt("GUIOnEventMode",1)
    GUISetOnEvent($GUI_EVENT_CLOSE,"_exit")
    GUICtrlSetOnEvent($Button1,"Button1")
    GUICtrlSetOnEvent($Checkbox1,"checkbox")
    While 1
        Sleep(20)
        If $Flag Then ExitLoop
    WEnd
    Opt("GUIOnEventMode",0)
EndFunc

Func Button1()
    MsgBox(64,"MSG","I'm inside a LOOP")
EndFunc

Func _exit()
    Exit
EndFunc

Func checkbox()
    $Flag = 1
EndFunc

 

Heroes, there is no such thing

One day I'll discover what IE.au3 has of special for so many users using it.
C'mon there's InetRead and WinHTTP, way better
happy.png

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...