API Frame SetScript

104,672pages on
this wiki
Add New Page
Talk0 Share
Widget API ← Frame < SetScript

Sets an event handler for a specific event type for this frame.

frame:SetScript("handler", func)

Parameters Edit

Arguments Edit

string - the name of the handler type, like 'OnShow', 'OnClick'. See Widget_handlers.
function - the Lua function to call or 'nil' to remove the handler

Examples Edit

for i = 1, 4 do
    local frame = _G["PartyMemberFrame"..i]
    frame:SetScript("OnShow", frame.Hide)

Adds an 'OnShow' event handler to all party frames to be called whenever they're shown.

PartyMemberFrame1:SetScript("OnShow", nil)

Removes whatever 'OnShow' handler was set from 'PartyMemberFrame1'.

See also Edit

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on Fandom

Random Wiki