Jump to content

OnEvent Mode and Event Msg


HeidiR
 Share

Recommended Posts

Is it possible to receive a second event while processing the first event with OnEvent Mode on?

Example: While executing a function from firdt event (process button click), which was spawned by GUICtrlSetOnEvent, is it possible to capture a second event (cancel button click) to stop the first event process? I looked at GUIGetMsg() but it does not work for OnEvent Mode.

HeidiRFind free applications, code examples and more on my site at:http://heidisdownloads.com/
Link to comment
Share on other sites

  • Developers

No other Event fire during the processing of an Event.

Not 100% sure, but I do think you can disable the GUIEvent mode and read the Messages with GUIGetMsg(), did you try that?

Another option you have is to set a global variable in the Func fired by the Event and return immediately and than act on that in your normal Loop.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

No other Event fire during the processing of an Event.

Not 100% sure, but I do think you can disable the GUIEvent mode and read the Messages with GUIGetMsg(), did you try that?

Another option you have is to set a global variable in the Func fired by the Event and return immediately and than act on that in your normal Loop.

Oh Jos, that was brilliant! I changed out of GUIEvent mode to Messageloop mode in the function fired by the first event. Then checked GUIGetMsg() for the cancel button event to abort the first process. Works perfectly! Thanks for your help!!!

The code snipit look like this:

CODE
Func process ()

; Do some process...

Opt("GUIOnEventMode", 0) ;Temporarly change to MessageLoop mode to capture abort button event

;Wait while process is running

While $process1_active

If GUIGetMsg() = $button4 Then abort () ;Stop process

Sleep(250)

Wend

Opt("GUIOnEventMode", 1) ;Change back to OnEvent mode

; Finish doing some process...

Endfunc

HeidiRFind free applications, code examples and more on my site at:http://heidisdownloads.com/
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...