WoW:API Frame SetScript: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 17: Line 17:


; ''Result:'' : Removes the OnShow handler function of PartyMemberFrame1.
; ''Result:'' : Removes the OnShow handler function of PartyMemberFrame1.
{{template:WoW API}}

Revision as of 17:55, 30 December 2005

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.

Template:WoW API