How to add element 'Show Animation Control' directly (not using Manipulate control setting)?
I am not able to find how to do the following. When using Manipulate, it automatically shows a little '+' at the end of the control, as the following
Manipulate[x,
{{x, 0, "x"}, 0, 1, .1, Appearance -> "Labeled"}
]
Now, I want to set up the control directly myself using Dynamic, and make it look just like the above, like this: (Btw, thanks to Simon for showing the correct syntax to do this here
Manipulate[x,
{{xChanged, False}, None},
Grid[{
{"x ",
Slider[Dynamic[x, (x = #; xChanged = True; #) &], {0, 1, .1}],
Spacer[2],
Dynamic@x
}
}, Frame -> None, Spacings -> {0.2, 0.1}, Alignment -> Center]
]
Now, the only thing missing is the little '+'. I can't use the AppearanceElement options on the above. So, next I tried this
Manipulate[x,
{{xChanged, False}, None},
Grid[{
{"x ",
Animator[Dynamic[x, (x = #; xChanged = True; #) &], {0, 1, .1},
AnimationRunning -> False], Spacer[2],
Dynamic@x
}
}, Frame -> None, Spacings -> {0.2, 0.1}, Alignment -> Center]
]
But that gives too many. I only need the '+' which is labeled 'Show animation controls' when using Manipulate. But I can't find the element which matches this one.
It is strange that it is so hard to find the names of these elements. I go to ref/AppearanceElements
and it does not even list the names. When I go to ref/Manipulate
it mentions the following ones under Appearance Elements option {"HideControlsButton", "SnapshotButton", "ResetButton", "UpdateButton"
and I tried them all, but they are not what I want.
I went to ref/Manipulator, and saw these "InputField", "StepLeftButton", "PlayPauseButton", "StepRightButton", "FasterSlowerButtons", "DirectionButton", "InlineInputField".
But none of them is the 'Show animation controls' one.
Does any one know how to get '+' element?
(strange that these elemen开发者_如何学编程ts are not all be listed in one place, in ref/AppearanceElements )
Thank you,
Is there any reason that you can't use a Manipulator
?
Manipulate[x, {{xChanged, False}, None}, {x, None},
Grid[{{"x ",
Manipulator[
Dynamic[x, (x = #; xChanged = True; #) &], {0, 1, .1}],
Spacer[2], Dynamic@x}}, Frame -> None, Spacings -> {0.2, 0.1},
Alignment -> Center]]
Or Control:
Manipulate[x,
Grid[{{"test: ", Control[{x, 0, 1}], Spacer[9], Dynamic[x]}},
Spacings -> {0.2, 0.1}]]
精彩评论