12.07.2015 Views

Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons

Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons

Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 16 ■ Binding Keys <strong>and</strong> Clicks to Addon Code 333GameTooltip:AddLine(TOOLTIP_TEXT1)GameTooltip:AddLine(TOOLTIP_TEXT2)local list = {GetBindingKey(self.action)}<strong>for</strong> i, key in ipairs(list) dolist[i] = GetBindingText(key, “KEY_“)endGameTooltip:AddLine(TOOLTIP_BINDING_LIST:<strong>for</strong>mat(table.concat(list, LIST_SEPARATOR)),NORMAL_FONT_COLOR.r,NORMAL_FONT_COLOR.g,NORMAL_FONT_COLOR.b,1)GameTooltip:Show()endfunction BindingTestButton_OnLeave(self)GameTooltip:Hide()endfunction BindingTestCapture_OnLoad(self)self:RegisterForClicks(“AnyUp“)endfunction BindingTestCapture_OnShow(self)self.text:SetText(CAPTURE_TEXT:<strong>for</strong>mat(self.button:GetID()))endfunction BindingTestCapture_OnKeyDown(self, key)if key == “ESCAPE“ thenself:Hide()returnendlocal modifier = key:sub(2)if modifier == “SHIFT“or modifier == “CTRL“or modifier == “ALT“or key == “UNKNOWN“ thenreturnendif GetBindingFromClick(key) == “SCREENSHOT“ thenTakeScreenshot()returnend

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!