(shift-)tabbing in rightPanel now advances to the (previous/)next stat's editBox
Paul Spears [10-22-09 - 08:00]
(shift-)tabbing in rightPanel now advances to the (previous/)next stat's editBox
loops at the (begginning/)end
diff --git a/WeightsWatcher.xml b/WeightsWatcher.xml
index f1e03eb..e396922 100644
--- a/WeightsWatcher.xml
+++ b/WeightsWatcher.xml
@@ -167,6 +167,9 @@
<OnEditFocusLost>
self:GetParent().highlightFrame:Hide()
</OnEditFocusLost>
+ <OnTabPressed>
+ changeFocus(self:GetParent())
+ </OnTabPressed>
</Scripts>
</EditBox>
</Frames>
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