From e7431738891eb3b3d7f8ef6fab55f57d39dffafd Mon Sep 17 00:00:00 2001 From: Paul Spears Date: Thu, 22 Oct 2009 03:00:23 -0500 Subject: [PATCH] (shift-)tabbing in rightPanel now advances to the (previous/)next stat's editBox loops at the (begginning/)end --- WeightsWatcher.xml | 3 +++ config.lua | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/WeightsWatcher.xml b/WeightsWatcher.xml index f1e03eb..e396922 100644 --- a/WeightsWatcher.xml +++ b/WeightsWatcher.xml @@ -167,6 +167,9 @@ self:GetParent().highlightFrame:Hide() + + changeFocus(self:GetParent()) + diff --git a/config.lua b/config.lua index e1d23dd..e710972 100644 --- a/config.lua +++ b/config.lua @@ -91,6 +91,9 @@ function scrollBarUpdate(scrollFrame, scrolledFrame, buttonHeight, initialOffset if offset > #(scrollFrame.shown) - numShown then offset = #(scrollFrame.shown) - numShown end + if offset < 0 then + offset = 0 + end FauxScrollFrame_Update(scrollFrame, #(scrollFrame.shown), numShown, buttonHeight * 5) scrolledFrame:SetPoint("TOPLEFT", 0, initialOffset + buttonHeight * offset) for i = 1, offset do @@ -104,6 +107,43 @@ function scrollBarUpdate(scrollFrame, scrolledFrame, buttonHeight, initialOffset end end +--moves the editbox focus to the next available edit box +function changeFocus(currentStatFrame) + local frame, offset + local elements = ww_config.rightPanel.scrollFrame.shown + local position = currentStatFrame.category.position + currentStatFrame.position + + if IsShiftKeyDown() then + direction = -1 + else + direction = 1 + end + repeat + position = position + direction + if not elements[position] then + if direction < 0 then + position = #(elements) + else + position = 1 + end + end + until elements[position].statName + + frame = elements[position] + if frame then + if not frame:IsShown() then + if direction < 0 then + offset = (position - 1) * 5 + else + offset = (position - 25) * 5 + end + FauxScrollFrame_SetOffset(ww_config.rightPanel.scrollFrame, offset) + ww_config.rightPanel.scrollFrame:GetScript("OnVerticalScroll")(ww_config.rightPanel.scrollFrame, offset * 20) + end + frame.statValue:SetFocus() + end +end + --opens a new config pane to edit stat weights function configSelectWeight(weightFrame) local empty -- 1.7.9.5