Jump to content

Closing GUI (OnEvent mode) Not working


alexf
 Share

Recommended Posts

Hi, I've written a GUI script which is running in OnEvent mode. Here's the problem: if the first/only "event" is a click on the exit button, it works how I want (closes the GUI/script). However, if I click the "start/begin operation" button, then the script attempts to complete the entire operation before accepting the "exit clicked" event (at least this is what I think is happening). Is there a way for me to work around this, or should I just not use OnEvent mode?

Link to comment
Share on other sites

Hi, I've written a GUI script which is running in OnEvent mode. Here's the problem: if the first/only "event" is a click on the exit button, it works how I want (closes the GUI/script). However, if I click the "start/begin operation" button, then the script attempts to complete the entire operation before accepting the "exit clicked" event (at least this is what I think is happening). Is there a way for me to work around this, or should I just not use OnEvent mode?

Yes, a function called by an event will be completed before the next event is dealt with.

One way round this is like this.

Leave the function that is called by your start/begin as it is but change the onevent function from the start/begin function to "startA".

In the new function startA simply sets a global varaiable to true say.

Func startA()
     $getgoing = true 
EndFunc

In you main idle loop have

if $getgoing then
 start();the original start/begin function
 $getgoing = false
endif

Now when you click on close it will respond straight away.

I hope that made sense.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...