WoW:API Frame SetScript: Difference between revisions
Jump to navigation
Jump to search
m
Move page script moved page API Frame SetScript to WoW:API Frame SetScript without leaving a redirect
m (Minor typo) |
m (Move page script moved page API Frame SetScript to WoW:API Frame SetScript without leaving a redirect) |
||
| (7 intermediate revisions by 7 users not shown) | |||
| Line 1: | Line 1: | ||
{{widgetmethod}} | {{widgetmethod}} | ||
Sets an event handler for a specific event type for this frame. | |||
frame:SetScript("handler", func) | |||
frame:SetScript("handler", | |||
== Parameters == | == Parameters == | ||
=== Arguments === | === Arguments === | ||
:;handler : string - the name of the handler type, like 'OnShow', 'OnClick'. See [[Widget_handlers]]. | |||
: | :;func : function - the Lua function to call or 'nil' to remove the handler | ||
== Examples == | |||
== | |||
for i = 1, 4 do | for i = 1, 4 do | ||
local frame = | local frame = _G["PartyMemberFrame"..i] | ||
frame:SetScript("OnShow", | frame:SetScript("OnShow", frame.Hide) | ||
end | end | ||
Adds an 'OnShow' event handler to all party frames to be called whenever they're shown. | |||
PartyMemberFrame1:SetScript("OnShow", nil) | PartyMemberFrame1:SetScript("OnShow", nil) | ||
Removes whatever 'OnShow' handler was set from 'PartyMemberFrame1'. | |||
Removes | |||
== See also == | |||
* {{api|Frame:GetScript|t=w}} | |||
* {{api|Frame:HookScript|t=w}} | |||
* [[Widget_handlers]] | |||