Message Boards Message Boards

3
|
8462 Views
|
3 Replies
|
5 Total Likes
View groups...
Share
Share this post:

Dynamic appearance of a control under ContinuousAction -> False

Posted 12 years ago
Imagine we have a heavy time consuming computation inside a Manipulate (which I model here by Pause[.5]):
Manipulate[Pause[.5]; x, {x, 0, 1, Appearance -> "Labeled"}]

In the above interface dragging the slider is tardy and rough due to slow content evaluation. In this case it is advisable to set ContinuousAction -> False so the dragging of the slider is smooth and evaluation happens only on the slider release.
Manipulate[Pause[.5]; x, {x, 0, 1, ContinuousAction -> False, Appearance -> "Labeled"}]

But the numerical labels do not change during this action and we only guessing at what numerical value the slider will land.

Question: how can I make the numerical labels of controls change during slider drag and keeping content static and updatable only on control release?

POSTED BY: Vitaliy Kaurov
3 Replies
Posted 12 years ago
Hi, Vitaliy . 

Here's a way.


Manipulate[
Pause[.5]; x,
Item[Manipulator[
Dynamic[y, {(y = #) &, (y = #) &, (y = x = #) &}], {0, 1},
ContinuousAction -> False,
Appearance -> {"Labeled", "Open"}]]
]


Xiang Li
POSTED BY: Xiang Li
Communication between controls and contents is done entirely though variable values. So if you want a control's display to update but some content to not change, then they'll need to be attached to different variables. Here's an example of a single control that changes two local Manipulate variables -- one continuously as the control changes, and another only when the mouse button is released:
Manipulate[
 Pause[.5]; x, {x, 0, 1, None}, {xtmp, 0, 1,
 Manipulator[
  Dynamic[xtmp, {Automatic, Automatic, (xtmp = #; x = #) &}], #2,
  Appearance -> "Labeled"] &}]
POSTED BY: Lou D'Andria
This is great, thank you!
POSTED BY: Vitaliy Kaurov
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