# Difference between action of a Slider and a HorizontalGauge

First time posting. I am working on creating some interactive materials for the engineering classes that I teach and have run into an issue that I cannot puzzle out. I am using a slider to allow for a user to interactively change parameters but I also want to allow for the user to change the range of the slider. When I implement this using the standard Slider everything works fine, however, if I replace the Slider with a HorizontalGauge, I get a situation where the pointer does not update smoothly.

So this works fine...

DynamicModule[{y = 1, LowerLimit = 1, UpperLimit = 10},
Column[{
Row[{
PopupMenu[Dynamic[UpperLimit], {5, 6, 7, 8, 9, 10}]
}],
Dynamic[Slider[Dynamic[y], {LowerLimit, UpperLimit}]],
Framed[
Row[{
"Slider Value", Spacer[10], Dynamic[y], Spacer[20],
"Lower Limit", Spacer[10], Dynamic[LowerLimit], Spacer[20],
"Upper Limit", Spacer[10], Dynamic[UpperLimit]
}]
]
}]
]


But with Slider replaced with HorizontalGauge, I run into problems...

DynamicModule[{y = 1, LowerLimit = 1, UpperLimit = 10},
Column[{
Row[{
PopupMenu[Dynamic[UpperLimit], {5, 6, 7, 8, 9, 10}]
}],
Dynamic[HorizontalGauge[Dynamic[y], {LowerLimit, UpperLimit}]],
Framed[
Row[{
"Slider Value", Spacer[10], Dynamic[y], Spacer[20],
"Lower Limit", Spacer[10], Dynamic[LowerLimit], Spacer[20],
"Upper Limit", Spacer[10], Dynamic[UpperLimit]
}]
]
}]
]


Any suggestions and/or explanations would be greatly appreciated!!!

-

I think HorizontalGauge is just buggy. It shouldn't trigger a dynamic update when you change its state but it does. Simplest case:

HorizontalGauge[Dynamic[x]] // Dynamic


I would try using this "fixed" version

horizontalGauge = Refresh[HorizontalGauge[##], None] &


By the way, you could stick this into the built-in symbol's definition, and perhaps if you are convinced, add it to an init.m autoload file

HorizontalGauge;
Unprotect[HorizontalGauge];
Module[{guard = True},
PrependTo[DownValues[HorizontalGauge],
HoldPattern[HorizontalGauge[args___] /; guard] :>
Block[{guard = False},
Refresh[HorizontalGauge[##], None] &[args]]]];
Protect[HorizontalGauge];

-
Nice! This works very well. Didn't you use this Refresh[..., None] trick elsewhere recently? –  rm -rf Jan 23 '13 at 22:16
@rm-rf, yes to fix Histogram, in the same way –  Rojo Jan 23 '13 at 22:16
Ah, yes. That's the one. –  rm -rf Jan 23 '13 at 22:17

Adding the option TrackedSymbols :> {LowerLimit, UpperLimit} to the Dynamic[..] that holds HorizontalGauge fixes the issue:

 DynamicModule[{y = 1, LowerLimit = 1, UpperLimit = 10},