Message Boards Message Boards

0
|
144 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Continuously display variables value within EventHandler

Posted 5 days ago

Consider this code:

DynamicModule[{cnt = 0}, Dynamic@ EventHandler[Dynamic[cnt], "MouseDown" :> (While[CurrentValue["MouseButtons"] == {1}, cnt++])]]

I want this code to continuously displays the value of "cnt", as it changes, on mousedown. Currently it displays only the final value when the mousebutton is released. Could somebody please tell me.

3 Replies
Posted 5 days ago

Neat. I was carried away by the elegant implementation of the "While" loop approach. Your solution is a simple fix. Thanks.

Posted 4 days ago

I wish it were my solution. It was the user Domen who always gives great answers.

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

Group Abstract Group Abstract