Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: '"Button" control object' topicStudent Support Forum > General > Archives > ""Button" control object"

< Previous CommentHelp | Reply To Comment | Reply To Topic
Author Comment/Response
Michael
01/13/13 9:51pm

In Response To 'Re: Re:'
---------
Look at the option setting

Method -> "Queued"

(instead Method -> "Preemptive")

An alternative might be to set a flag and have the action check the flag to see if Mathematica was in the middle of evaluating another button click. Or you might use them together.

This one discards clicks until it's done with the action:

Button["hi",
If[actionFlag =!= "busy", actionFlag = "busy"; Pause[2]; Beep[];
actionFlag = "free"]]

This one queues clicks, so each click results in a beep after a wait.

Button["hi",
If[actionFlag =!= "busy", actionFlag = "busy"; Pause[2]; Beep[];
actionFlag = "free"], Method -> "Queued"]


URL: ,

Subject (listing for '"Button" control object')
Author Date Posted
"Button" control object PhysicsGuy 01/11/13 00:06am
Re: "Button" control object Michael 01/11/13 8:58pm
Re: Re: PhysicsGuy 01/12/13 8:20pm
Re: Re: PhysicsGuy 01/13/13 12:06pm
Re: Re: Re: Michael 01/13/13 9:51pm
< Previous CommentHelp | Reply To Comment | Reply To Topic