Group Abstract Group Abstract

Message Boards Message Boards

0
|
286 Views
|
4 Replies
|
4 Total Likes
View groups...
Share
Share this post:

How to code Control changes?

Posted 23 days ago
POSTED BY: Werner Geiger
4 Replies

Or using a multi argument Dynamic like this

DynamicModule[{f, x, arg, val},
 f[x_] := {x, Sqrt[x]};
 x = 0;
 {arg, val} = f[x];

 Column[
  {Slider[
    Dynamic[x,
     (
       x = #;
       {arg, val} = f[x]
       ) &
     ],
    {0, 25, 1}
    ],
   Row[{"{arg,val} = ", Dynamic@{arg, val}}]}]
 ]
POSTED BY: David Reiss
Posted 21 days ago

This works. Thanks David.

POSTED BY: Werner Geiger

This variant seems to work:

DynamicModule[{f, x = 5, arg, val},
 f[x_] := {x, Sqrt[x]};
 Column[{Slider[Dynamic@x, {0, 25, 1}],
   Dynamic[{arg, val} = f[x]],
   Row[{"{arg,val} = ", Dynamic@{arg, val}}]}]]
POSTED BY: Gianluca Gorni
Posted 21 days ago

This works. Thanks Gianluca.

(I think I tried this before. No idea why I thought it would not work).

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