WoW:API Frame SetScript: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
({{widgetmethod}})
m (Minor typo)
Line 22: Line 22:


====Result====
====Result====
All party frames will be hidden whenever they're show.
All party frames will be hidden whenever they're shown.


  PartyMemberFrame1:SetScript("OnShow", nil)
  PartyMemberFrame1:SetScript("OnShow", nil)

Revision as of 16:47, 26 December 2006

Widget API ← Frame < SetScript

Frame:SetScript -Documentation by Author-

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.

Example

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.

PartyMemberFrame1:SetScript("OnShow", nil)

Result

Removes the OnShow handler from PartyMemberFrame1.