Sign in to follow this  
Followers 0
Velnes

button confused

4 posts in this topic

hi autoit team

i have 2 buttons start and stop [examples]

and if u press start it runs functiosn as follows

func _run()
;==some loop here
func2()
endfunc

func func2()
;looop here is well
_run() ;returns back and does the same things again....
endfunc

and now bcz of this stop button wont work...

how to make the button work .. to just stop all progress not pause or exit the program(gui)

Share this post


Link to post
Share on other sites



hi autoit team

i have 2 buttons start and stop [examples]

and if u press start it runs functiosn as follows

func _run()
;==some loop here
func2()
endfunc

func func2()
;looop here is well
_run() ;returns back and does the same things again....
endfunc

and now bcz of this stop button wont work...

how to make the button work .. to just stop all progress not pause or exit the program(gui)

I cant see a button in your code.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

well i just gave an example...

lets say button is

$btn = guictrlcreatebutton("stop/start", 0, 0, 100, 20) ;supposed to be 2 buttons but lets do with one...

Share this post


Link to post
Share on other sites

Velnes,

That snippet you posted will lead you into big trouble. :)

It is infinitely recursive - that is to say that you call a function again from within itself - like this:

Start _run()   - instance 1

Start func2()  - instance 1 

Start _run()   - instance 2

Start func2()  - instance 2

Start _run()   - instance 3

and so on ad infinitum......you never return from any of the functions.  :blink:

First I suggest that you read the Recursion tutorial in the Wiki - it will explain why recursion can be so dangerous.

Next, I suggest you rewrite your script so that you do not use infinitely recursive loops like that.

Finally, I suggest you read the Interrupting a running function tutorial in the Wiki - which should help you see how to keep your "Stop" button active even when you are running your functions.

Have fun! :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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