Quantcast
Enforce SetValue() of AceConfig-3.0 slider? - WoWInterface
Thread Tools Display Modes
10-13-20, 06:05 PM   #1
LudiusMaximus
A Cobalt Mageweaver
 
LudiusMaximus's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 227
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,
},
__________________
~ Be the change you want to see in the world... of warcraft interface! ~
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Enforce SetValue() of AceConfig-3.0 slider?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off