如何直接添加元素“显示动画控件"(不使用操纵控件设置)? [英] How to add element 'Show Animation Control' directly (not using Manipulate control setting)?

查看:13
本文介绍了如何直接添加元素“显示动画控件"(不使用操纵控件设置)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法找到如何执行以下操作.使用Manipulate时,会自动在控件末尾显示一个小'+',如下

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"}
 ]

现在,我想自己使用 Dynamic 直接设置控件,并使它看起来像上面一样,如下所示:(顺便说一句,感谢 Simon 展示了正确的语法来执行此操作 这里

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]
 ]

现在,唯一缺少的是小+".我不能在上面使用 AppearanceElement 选项.所以,接下来我尝试了这个

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]

 ]

但这给了太多.使用 Manipulate 时,我只需要标记为显示动画控件"的+".但是我找不到与此匹配的元素.

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.

奇怪的是,很难找到这些元素的名称.我转到 ref/AppearanceElements,它甚至没有列出名称.当我转到 ref/Manipulate 时,它在 Appearance Elements 选项 {"HideControlsButton", "SnapshotButton", "ResetButton", "UpdateButton" 下提到了以下内容,我尝试了它们全部,但它们不是我想要的.

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.

我去了 ref/Manipulator,看到了这些 InputField"、StepLeftButton"、PlayPauseButton"、StepRightButton"、FasterSlowerButtons"、DirectionButton"、InlineInputField". 但没有其中之一是显示动画控件".

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?

(奇怪的是这些元素并没有全部列在一个地方,在 ref/AppearanceElements 中)

(strange that these elements are not all be listed in one place, in ref/AppearanceElements )

谢谢,

推荐答案

有什么理由不能使用 Manipulator?

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]]

这篇关于如何直接添加元素“显示动画控件"(不使用操纵控件设置)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆