Message Boards Message Boards

0
|
3503 Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

Multiple variables with one control?

Posted 9 years ago

Would it be possible to have one control (SetterBar) having access to multiple variables? For example, if I wanted to control variables a and b, could I have one button set (a=1 and b=0) and another button set (a=0 and b=2)?

POSTED BY: Darwin Kim

It is probably best to use a list for this purpose.

SetterBar[Dynamic[x], {{1, 2}, {3, 4}, {5, 6}}]

Dynamic[First[x]]

Dynamic[Last[x]]

In any case, you could make this work with Button if you wanted to, but using a list would be easier.

POSTED BY: Sean Clarke
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