Thread: Slider problems
View Single Post
09-18-13, 04:40 PM   #11
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by Phanx View Post
I'm not sure what you mean... slider widgets have always run OnValueChanged scripts 498302483242 times a second while the user is dragging the slider. To ignore changes during dragging, and only update when the slider is released, you'd use OnMouseUp instead of OnValueChanged, or check IsMouseButtonDown in your OnValueChanged script and either ignore changes made with a mouse button down, or only pass values to the addon while the mouse button is down if the last value was passed more than X time ago. The only thing that's changed in 5.4 is that the values passed to OnValueChanged scripts while the slider is being dragged no longer respect the slider's step value. Nothing else has changed.
Well my method woks like that on every OnValueChanged i do something like this:

Lua Code:
  1. local SliderValue = Slider:GetValue()
  2. if (SliderValue ~= SavedVariable) then
  3.     -- Change it's value
  4. end

This also stop the pointless cpu usage when you hold the mouse button down on the slider but not moving it. And it's working pretty well with a well set ValueStep, even when i go nuts on sliders it's wont use more then 0.5-1% cpu time. (But depends on which function is the slider handling.)
  Reply With Quote