View Feature Request
Add function to redraw panels
Feature #: 51
File: LibAddonMenu-2.0
Date: 04/06/14 01:12 PM
By: Scelestis
Status: Wont add Feature
I'm trying to make 2 sliders that can't go above/below the other's setting:

LAM:AddSlider(ID, "Name1", "TT", sv.criticalThreshold+1, 100, 1, function() return sv.warningThreshold end, function( val ) sv.warningThreshold = val end)

LAM:AddSliderID, "Name1", "TT", 0, sv.warningThreshold-1, 1, function() return sv.criticalThreshold end, function( val ) sv.criticalThreshold = val end)

the min/max of each slider is based of settings the other slider modifies, but once you set one, the other would need to be redrawn.

I'd like to see a LAM:ReDraw(ID, PANEL) or something of the like.

RSS 2.0 Feed for Favorite CommentsNotes Sort Options
By: Seerah - 04/06/14 03:33 PM
LAM:AddSlider() returns a reference to the slider option.

Code:
local sliderOptions = LAM:AddSlider(........)
local slider = sliderOptions:GetNamedChild("Slider")
slider:SetMinMax(min, max)
or even just this works since you've got global names for the frames
Code:
LAM:AddSlider(ID, "Name1", .......)
Name1Slider:SetMinMax(min, max)
By: zgrssd - 05/24/14 07:46 PM
How about doing this logic in the get/set functions instead of the Slider?
Sliders are only a convenient way to assign numerical values.
It is not that the sliders should not be outside a certain range. It is that the values they represent should not be out of a certain range. And if they should not be out of that range when beign set by the slider, they should never be out of that range.

Note that a passive error model (accept all entries but give a warning message if they do not match the rules) is generally a better idea then trying to enforce certain values.
By: ivanwfr - 05/30/14 06:50 AM
I could find a solution to do exactly what you are looking for that works with the current version. I used it for the Alert+Warning items quantity of Greymind Quick Slot Bar Settings menu.
By: ivanwfr - 05/30/14 11:51 AM
Code:
-- slider 1 setFunc
function(value)
    if(value <= QuantityAlert) then
        value = QuantityAlert+1
        -- discard changes
        QuantitySlider:GetNamedChild("Slider"    ):SetValue(value/(Q_MAX+1))
        QuantitySlider:GetNamedChild("ValueLabel"):SetText (tostring(value))
    end
    QuantityWarning = value
    Refresh()
    Show()
end

-- slider 2 etFunc
function(value)
    if(value >= QuantityWarning) then
        value = QuantityWarning-1
        -- discard changes
        QuantitySlider:GetNamedChild("Slider"    ):SetValue(value/(Q_MAX+1))
        QuantitySlider:GetNamedChild("ValueLabel"):SetText (tostring(value))
    end
    QuantityAlert = value
    Refresh()
    Show()
end