WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Enforce SetValue() of AceConfig-3.0 slider? (https://www.wowinterface.com/forums/showthread.php?t=58272)

LudiusMaximus 10-13-20 06:05 PM

Enforce SetValue() of AceConfig-3.0 slider?
 
I am using https://www.wowace.com/projects/ace3...options-tables for my addon's options. I have two sliders to define an interval: first slider "lower bound", second slider "upper bound".
Lower bound must never be greater than upper bound, and vice versa. So whenever the user drags one slider beyond the other slider's position, the other slider's value gets increased/decreased automatically. But visually, the other slider only gets updated after the user releases the dragged slider. Is there a way to refresh the other slider while the user is still dragging? I already tried `LibStub("AceConfigRegistry-3.0"):NotifyChange("MyAddon")` but this leads to the dragged slider being released at once.

Code:

lowerBound = {
  type = 'range',
  min = 0,
  max = 10,
  step = 1,
  get = function() return MyAddon.lowerBound end,
  set = function(_, newValue)
    MyAddon.lowerBound = newValue
    if MyAddon.upperBound < newValue then
      MyAddon.upperBound = newValue
      -- TODO: Update upperBound slider even while the user is still dragging lowerBound.
    end
  end,
},

upperBound = {
  type = 'range',
  min = 0,
  max = 10,
  step = 1,
  get = function() return MyAddon.upperBound end,
  set = function(_, newValue)
    MyAddon.upperBound = newValue
    if MyAddon.lowerBound > newValue then
      MyAddon.lowerBound = newValue
      -- TODO: Update lowerBound slider even while the user is still dragging upperBound.
    end
  end,
},



All times are GMT -6. The time now is 09:25 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI