Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Default Value for SetterBar

  • To: mathgroup at smc.vnet.net
  • Subject: [mg113749] Re: Default Value for SetterBar
  • From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
  • Date: Wed, 10 Nov 2010 06:29:22 -0500 (EST)
  • References: <ibb25g$54a$1@smc.vnet.net>

This has to do with accuracy of the representation of the reals you
use. Comparing reals in this way is pretty dangerous

In[17]:= Range[.2,.5,.05]//FullForm

Out[17]//FullForm= List[0.2`,0.25`,0.30000000000000004`,
0.35000000000000003`,0.4`,0.45`,0.5`]

So, you really don't have a 0.35 in your range of values. The
following works better.

Manipulate[x, {{x, .35, "My Variable"}, Range[2/10, 5/10, 5/100] // N,
   ControlType -> SetterBar}]


Cheers -- Sjoerd

On Nov 9, 9:53 am, Gregory Lypny <gregory.ly... at videotron.ca> wrote:
> Hello everyone,
>
> I have a default value for a variable, x, in a Manipulate.  It uses a setter bar.
>
>         {x, .35, "My Variable"}, Range[.2, .5, .05], ControlType -> SetterBar}
>
> But unlike a slider whose thumb position moves to the default value when the Manipulate is first opened, the default value on the setter bar is not highlighted.  How can I get it to highlight so that users know where they are starting?
>
> Regards,
>
> Gregory



  • Prev by Date: Re: pause button for Dynamic?
  • Next by Date: Re: Writing functions in packages that define values of global variables
  • Previous by thread: Re: Default Value for SetterBar
  • Next by thread: Re: Default Value for SetterBar