Sign in to follow this  
Followers 0
Markus

GUICtrlSetOnEvent Problems

10 posts in this topic

Hello!

I wrote a script to look for numbers who can only be divided through themselves and through 1.

2,3,5,7,11,13,17,19 and so on. It works very nice. But there are some problems left. because in this script i also have many other functions, its a gui maths box u can do many things that have to do with maths. So I have many buttons. The problem now is, that if I start the search function with a GUICtrlSetOnEvent-button and i want to use another button/function with a set on event function, the second button function doesnt start, because the PC wants to finish the search function, startet by the first button. Is there any way to stop the search function by a button, while search function is running? Please help me. Maybe there's already a topic posted, but i haven't found one, that's exactly about my problem.


"It's easier to disintegrate an atom than a prejudice." (A.Einstein)---------------------------------------------------------------------------My C++ - tools:Tidy tool-->indents your c++ sourceCleanscript --> cleans autoit-code before compiling (co-author: peethebee)My tools:GUIBuilder-->build your window and get the source; german versionMy Games:OnlineGameCenter-->Online Chess and Connect4 with a rtf-chatSnake-->including a level editor to build your own levelsTetris-->the well known game, big funOther things:Tower of Hanoi-->perfect riddler with graphic output

Share this post


Link to post
Share on other sites



Hello!

I wrote a script to look for numbers who can only be divided through themselves and through 1.

2,3,5,7,11,13,17,19 and so on. It works very nice. But there are some problems left. because in this script i also have many other functions, its a gui maths box u can do many things that have to do with maths. So I have many buttons. The problem now is, that if I start the search function with a GUICtrlSetOnEvent-button and i want to use another button/function with a set on event function, the second button function doesnt start, because the PC wants to finish the search function, startet by the first button. Is there any way to stop the search function by a button, while search function is running? Please help me. Maybe there's already a topic posted, but i haven't found one, that's exactly about my problem.

You could use HotKeySet to setup a key to stop the search function.


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

You could use HotKeySet to setup a key to stop the search function.

Right, I used this solution but i didnt like it, because i want that my buttons are useable in this function. I hate uselss buttons.

"It's easier to disintegrate an atom than a prejudice." (A.Einstein)---------------------------------------------------------------------------My C++ - tools:Tidy tool-->indents your c++ sourceCleanscript --> cleans autoit-code before compiling (co-author: peethebee)My tools:GUIBuilder-->build your window and get the source; german versionMy Games:OnlineGameCenter-->Online Chess and Connect4 with a rtf-chatSnake-->including a level editor to build your own levelsTetris-->the well known game, big funOther things:Tower of Hanoi-->perfect riddler with graphic output

Share this post


Link to post
Share on other sites

Right, I used this solution but i didnt like it, because i want that my buttons are useable in this function. I hate uselss buttons.

instead of functions, you could use seperate compiled scripts (with tray icons disabled) that way when you click the button, it runs the other script with a Run() so it can continue it's own execution. without multi-threading, you kind of have to fake it.

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

because the PC wants to finish the search function, startet by the first button. Is there any way to stop the search function by a button, while search function is running? Please help me. Maybe there's already a topic posted, but i haven't found one, that's exactly about my problem.

from the help file:

OnEvent Mode

In the On Event mode instead of constantly polling the GUI to find out if anything has happened you make the GUI temporarily pause your script and call a pre-defined function to handle the event. For example, if the user clicks Button1 the GUI halts your main script and calls a previously defined user function that deals with Button1

So, I guess there is no way to interrupt your search function while it is running. To do so with one single script, we would need multithreading, which is not implemented. So, your options are:

1.) Use HotKeySet

2.) Use multiple Scripts for your functions, compile them and call em via Run(). However, then you'll have to pass the calling parameters and results between the scripts. Possible (through Registry, INI files or ENV variables) but kind of "ugly".

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

from the help file:

OnEvent Mode

In the On Event mode instead of constantly polling the GUI to find out if anything has happened you make the GUI temporarily pause your script and call a pre-defined function to handle the event. For example, if the user clicks Button1 the GUI halts your main script and calls a previously defined user function that deals with Button1

So, I guess there is no way to interrupt your search function while it is running. To do so with one single script, we would need multithreading, which is not implemented. So, your options are:

1.) Use HotKeySet

2.) Use multiple Scripts for your functions, compile them and call em via Run(). However, then you'll have to pass the calling parameters and results between the scripts. Possible (through Registry, INI files or ENV variables) but kind of "ugly".

Cheers

Kurt

neat, maybe i am making progress... offered almost the same advice (although not as smart sounding) as kurt!

;)


1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

neat, maybe i am making progress... offered almost the same advice (although not as smart sounding) as kurt!

;)

:P

I didn't see your reply. I started to write mine and was interrupted ...

Cheers

Kurt

Edited by /dev/null

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

;)

I didn't see your reply. I started to write mine and was interrupted ...

Cheers

Kurt

been there a million times myself, but i really didn't mean it like that, was patting myself on the back for the similar response

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

been there a million times myself, but i really didn't mean it like that, was patting myself on the back for the similar response

NP!

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

Thank you very much I think that will help me ;)


"It's easier to disintegrate an atom than a prejudice." (A.Einstein)---------------------------------------------------------------------------My C++ - tools:Tidy tool-->indents your c++ sourceCleanscript --> cleans autoit-code before compiling (co-author: peethebee)My tools:GUIBuilder-->build your window and get the source; german versionMy Games:OnlineGameCenter-->Online Chess and Connect4 with a rtf-chatSnake-->including a level editor to build your own levelsTetris-->the well known game, big funOther things:Tower of Hanoi-->perfect riddler with graphic output

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  
Followers 0