Widget API: Button:Click

From AddOn Studio
Revision as of 04:45, 15 August 2023 by Move page script (talk | contribs) (Move page script moved page API Button Click to API Button Click without leaving a redirect)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Widget API ← Button < Click

Clicks a button.

MyButton:Click(virtual mouse button)

Arguments[edit]

virtual mouse button
String. The mouse button to virtually click the button with. Whatever gets passed here will be used as arg1 in the button's OnClick script handler.

Example[edit]

local f = CreateFrame("Button")
f:SetScript("OnClick", function(self, arg1)
    print(arg1)
end)
f:Click("foo bar") -- will print "foo bar" in the chat frame.
f:Click("blah blah") -- will print "blah blah" in the chat frame.

Notes[edit]

  • This does not work on secure buttons.