WoW:UIHANDLER OnClick: Difference between revisions

m
Move page script moved page UIHANDLER OnClick to WoW:UIHANDLER OnClick without leaving a redirect
(→‎Example: +XML handlers)
m (Move page script moved page UIHANDLER OnClick to WoW:UIHANDLER OnClick without leaving a redirect)
 
(One intermediate revision by one other user not shown)
Line 9: Line 9:
==Example==
==Example==
  local taunts = {"I'm a button.", "Quit clicking me.", "That's enough.", "Stop it!", "I'm leaving!"};
  local taunts = {"I'm a button.", "Quit clicking me.", "That's enough.", "Stop it!", "I'm leaving!"};
  local widget = CreateFrame("Button", "TauntingButton", UIParent, "UIPanelButonTemplate");
  local widget = CreateFrame("Button", "TauntingButton", UIParent, "UIPanelButtonTemplate");
  widget:SetWidth(200); widget:SetHeight(24); widget:SetPoint("CENTER");
  widget:SetWidth(200); widget:SetHeight(24); widget:SetPoint("CENTER");
  widget:RegisterForClicks("AnyUp");
  widget:RegisterForClicks("AnyUp");
  widget:SetHandler("OnClick", function (self, button, down)
  widget:SetScript("OnClick", function (self, button, down)
   self:SetID((self:GetID() or 1) + 1);
   self:SetID((self:GetID() or 1) + 1);
   if taunts[self:GetID()] then
   if taunts[self:GetID()] then
Anonymous user