WoW:API Frame SetScript

From AddOn Studio
Revision as of 11:09, 20 September 2005 by WoWWiki>Murkeli
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Sets the action handler for this frame or removes the handler with a nil function

frame:SetScript("handler", function);

Arguments:

"handler" is the action to set, i.e. "OnShow" or "OnEvent".
function is the function you want to set for the handler.

Example 1:
for i = 1, 4 do
local frame = getglobal("PartyMemberFrame"..i);
frame:SetScript("OnShow", function() this:Hide(); end);
end
Result:
All party frames will be hidden whenever they're shown.


Example 2:
PartyMemberFrame1:SetScript("OnShow", nil);
Result:
Removes the OnShow handler function of PartyMemberFrame1.