From 097547cbe46300e8b26763c54b37fd23b66d47ff Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Wed, 31 Mar 2010 07:34:35 -0400 Subject: [PATCH] Moved updating of the up/down button states from ScrollBar_Scroll() to the ScrollBar's OnValueChanged script handler. --- Frame.lua | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/Frame.lua b/Frame.lua index 1139af1..101fc7d 100644 --- a/Frame.lua +++ b/Frame.lua @@ -2524,13 +2524,6 @@ ScrollBar:SetThumbTexture("Interface\\Buttons\\UI-ScrollBar-Knob") ScrollBar:SetMinMaxValues(0, 1) ScrollBar:SetValueStep(1) --- This can be called either from ListFrame's OnMouseWheel script, manually --- sliding the thumb, or from clicking the up/down buttons. -ScrollBar:SetScript("OnValueChanged", - function(self, value, ...) - ListFrame:Update(nil, true) - end) - ListFrame.scroll_bar = ScrollBar ------------------------------------------------------------------------------- @@ -2578,17 +2571,6 @@ do cur_val = math.max(min_val, cur_val - SCROLL_DEPTH) ScrollBar:SetValue(cur_val) end - - if cur_val == min_val then - ScrollUpButton:Disable() - ScrollDownButton:Enable() - elseif cur_val == max_val then - ScrollUpButton:Enable() - ScrollDownButton:Disable() - else - ScrollUpButton:Enable() - ScrollDownButton:Enable() - end end ScrollUpButton:SetScript("OnClick", @@ -2611,6 +2593,25 @@ do ScrollBar_Scroll(delta) end) + -- This can be called either from ListFrame's OnMouseWheel script, manually + -- sliding the thumb, or from clicking the up/down buttons. + ScrollBar:SetScript("OnValueChanged", + function(self, value, ...) + local min_val, max_val = self:GetMinMaxValues() + + if value == min_val then + ScrollUpButton:Disable() + ScrollDownButton:Enable() + elseif value == max_val then + ScrollUpButton:Enable() + ScrollDownButton:Disable() + else + ScrollUpButton:Enable() + ScrollDownButton:Enable() + end + ListFrame:Update(nil, true) + end) + local function Button_OnEnter(self) ListItem_ShowTooltip(self, ListFrame.entries[self.string_index]) end -- 1.7.9.5