WoW:API Frame SetScript: Difference between revisions
Jump to navigation
Jump to search
m (→Arguments) |
(Update link to additional widget handlers) |
||
Line 10: | Line 10: | ||
:("handler", func) | :("handler", func) | ||
:;handler : String - The handler to attach func to (OnShow, OnEvent, [[ | :;handler : String - The handler to attach func to (OnShow, OnEvent, [[Widget_handlers|et al]]) | ||
:;func : Function - The function to call. <tt>nil</tt> to remove the handler. <tt>func</tt> is called with arguments <tt>(frame, event, arg1, arg2, ...)</tt> | :;func : Function - The function to call. <tt>nil</tt> to remove the handler. <tt>func</tt> is called with arguments <tt>(frame, event, arg1, arg2, ...)</tt> | ||
Line 16: | Line 16: | ||
for i = 1, 4 do | for i = 1, 4 do | ||
local frame = getglobal("PartyMemberFrame"..i) | local frame = getglobal("PartyMemberFrame"..i) | ||
frame:SetScript("OnShow", function() | frame:SetScript("OnShow", function(self) self:Hide() end) | ||
end | end | ||
Revision as of 02:28, 29 December 2007
← Widget API ← Frame < SetScript
Sets the action handler for this frame.
frame:SetScript("handler", function)
Parameters
Arguments
- ("handler", func)
- handler
- String - The handler to attach func to (OnShow, OnEvent, et al)
- func
- Function - The function to call. nil to remove the handler. func is called with arguments (frame, event, arg1, arg2, ...)
Example
for i = 1, 4 do local frame = getglobal("PartyMemberFrame"..i) frame:SetScript("OnShow", function(self) self:Hide() end) end
Result
All party frames will be hidden whenever they're shown.
PartyMemberFrame1:SetScript("OnShow", nil)
Result
Removes the OnShow handler from PartyMemberFrame1.