From fd92e2d6faf1ecc8228fd094acd1330ec81a4ea6 Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Tue, 30 Mar 2010 09:31:31 -0400 Subject: [PATCH] In ListFrame:Update(): Only reset the buttons/lines if there are entries in the list. --- Frame.lua | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/Frame.lua b/Frame.lua index fe5db30..b5e0c76 100644 --- a/Frame.lua +++ b/Frame.lua @@ -2892,28 +2892,9 @@ do self:Initialize(expand_mode) end - -- Reset the current buttons/lines - for i = 1, NUM_RECIPE_LINES do - local entry = self.entry_buttons[i] - local state = self.state_buttons[i] - - entry.string_index = 0 - entry:SetText("") - entry:SetScript("OnEnter", nil) - entry:SetScript("OnLeave", nil) - - state.string_index = 0 - state:Hide() - state:SetScript("OnEnter", nil) - state:SetScript("OnLeave", nil) - - state:ClearAllPoints() - end local num_entries = #self.entries if num_entries > 0 then - local button_index = 1 - local string_index = button_index + _G.FauxScrollFrame_GetOffset(self) local scroll_bar = _G[self:GetName().."ScrollBar"] if num_entries > NUM_RECIPE_LINES then @@ -2928,6 +2909,27 @@ do ARL_ExpandButton:SetNormalFontObject("GameFontNormalSmall") ARL_ExpandButton:Enable() + -- Reset the current buttons/lines + for i = 1, NUM_RECIPE_LINES do + local entry = self.entry_buttons[i] + local state = self.state_buttons[i] + + entry.string_index = 0 + entry:SetText("") + entry:SetScript("OnEnter", nil) + entry:SetScript("OnLeave", nil) + + state.string_index = 0 + state:Hide() + state:SetScript("OnEnter", nil) + state:SetScript("OnLeave", nil) + + state:ClearAllPoints() + end + + local button_index = 1 + local string_index = button_index + _G.FauxScrollFrame_GetOffset(self) + -- Populate the buttons with new values while button_index <= NUM_RECIPE_LINES and string_index <= num_entries do local cur_state = self.state_buttons[button_index] -- 1.7.9.5