Group Abstract Group Abstract

Message Boards Message Boards

1
|
7.5K Views
|
3 Replies
|
1 Total Like
View groups...
Share
Share this post:

[?] Avoid problems with code execution of a button?

I want to execute the function moverIntXx within the button and nothing happen. If I execute the function outside the button, the function runs fine. What is that I don' t understand? Thanks.

SetAttributes[moverIntXx,HoldFirst];
moverIntXx[var_,n_]:=Module[{t},
t=Flatten[Table[{1,2,3},{i,1,n}]];
Map[(Pause[0.05];FinishDynamic[];var=#)&,t];
];
Dynamic[var]
Button[
    Style[Tooltip["Clic"], Red,FontFamily->"Palatino",18],
    moverIntXx[var,6],Appearance->"Frameless"]
Attachments:
POSTED BY: Ernesto Espinosa
3 Replies

Thank you Gustavo, it works.

POSTED BY: Ernesto Espinosa

For such small amount of code, please also include the code in the post in the future, as we did for you now. This imporves post readability. How to proper format code is explained in the rules: http://wolfr.am/READ-1ST

POSTED BY: EDITORIAL BOARD

Adding option Method -> "Queued" to the button helps.

POSTED BY: Gustavo Delfino
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard