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

MathGroup Archive 2010

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

Search the Archive

customized sliders

  • To: mathgroup at smc.vnet.net
  • Subject: [mg108898] customized sliders
  • From: telefunkenvf14 <rgorka at gmail.com>
  • Date: Tue, 6 Apr 2010 07:25:36 -0400 (EDT)

I came across the following code in the documentation (on Advanced
Manipulate):

ValueThumbSlider[v_] := ValueThumbSlider[v, {0, 1}];
ValueThumbSlider[Dynamic[var_], {min_, max_}, options___] :=
  LocatorPane[
   Dynamic[If[! NumberQ[var], var = min]; {var,
     0}, (var = First[#]) &],
   Graphics[{AbsoluteThickness[1.5], Line[{{min, 0}, {max, 0}}],
     Dynamic[{Text[var, {var, 0}, {0, -1}],
       Polygon[{Offset[{0, -1}, {var, 0}], Offset[{-5, -8}, {var, 0}],
          Offset[{5, -8}, {var, 0}]}]}]},
    ImageSize -> {300, 30},
    PlotRange -> {{min, max} + 0.1 {-1, 1} (max - min), {-1, 1}},
    AspectRatio -> 1/10],
   {{min, 0}, {max, 0}}, Appearance -> None];
ValueThumbSlider[Dynamic[xx], {0, 10}]

This creates a customized slider by drawing (and offsetting) a
Polygon[].

I'd *really* like to be able to use some other image---such as a .png
of a slider designed by someone else. Is there an easy way to
accomplish this?

-RG




  • Prev by Date: Re: size of ticks
  • Next by Date: Re: Exporting a vector
  • Previous by thread: Re: Will FindFit invoke LinearProgramming?
  • Next by thread: Fix for "INTERNAL SELF-TEST ERROR: MacFont|c|818"