Fix for 'this' and 'self', thanks to sylvanaar
James Whitehead II [09-05-10 - 09:56]
Fix for 'this' and 'self', thanks to sylvanaar
diff --git a/Clique.xml b/Clique.xml
index 92b29f6..fdc8115 100644
--- a/Clique.xml
+++ b/Clique.xml
@@ -73,18 +73,16 @@
</Size>
<Scripts>
<OnTextChanged>
- local scrollBar = getglobal(this:GetParent():GetName().."ScrollBar")
- this:GetParent():UpdateScrollChildRect();
- local min;
- local max;
- min, max = scrollBar:GetMinMaxValues();
- if ( max > 0 and (this.max ~= max) ) then
- this.max = max;
- scrollBar:SetValue(max);
+ local scrollBar = _G[self:GetParent():GetName() .. "ScrollBar")
+ self:GetParent():UpdateScrollChildRect()
+ local min, max = scrollBar:GetMinMaxValues();
+ if max > 0 and self.max ~= max then
+ this.max = max;
+ scrollBar:SetValue(max);
end
</OnTextChanged>
<OnEscapePressed>
- this:ClearFocus();
+ self:ClearFocus();
</OnEscapePressed>
</Scripts>
<FontString inherits="GameFontHighlightSmall"/>
diff --git a/CliqueOptions.lua b/CliqueOptions.lua
index 001f86a..aa3552b 100644
--- a/CliqueOptions.lua
+++ b/CliqueOptions.lua
@@ -719,7 +719,9 @@ function Clique:CreateOptionsFrame()
button:SetWidth(175)
button:SetText("Set Click Binding")
button:SetPoint("TOP", CliqueCustomHelpText, "BOTTOM", 40, -10)
- button:SetScript("OnClick", function(self) Clique:CustomBinding_OnClick(self) end )
+ button:SetScript("OnClick", function(self, ...)
+ Clique:CustomBinding_OnClick(self, ...)
+ end)
button:RegisterForClicks("AnyUp")
-- Button for icon selection
@@ -1403,10 +1405,10 @@ function Clique:DropDown_OnShow(frame)
Clique:ListScrollUpdate()
end
-function Clique:CustomBinding_OnClick(frame)
+function Clique:CustomBinding_OnClick(frame, ...)
-- This handles the binding click
local mod = self:GetModifierText()
- local button = arg1
+ local button = ...
if self.editSet == self.clicksets[L.CLICKSET_HARMFUL] then
button = string.format("%s%d", "harmbutton", self:GetButtonNumber(button))
@@ -1418,7 +1420,7 @@ function Clique:CustomBinding_OnClick(frame)
self.customEntry.modifier = mod
self.customEntry.button = button
- frame:SetText(string.format("%s%s", mod, arg1))
+ frame:SetText(string.format("%s%s", mod, button))
end
local buttonSetup = {