Widget/API/RegisterEvent

== RegisterEvent ==
Registers an ingame event to watch.
A frame is needed with an ..._OnEvent function which captures events and acts accordingly to the registered events.
Syntax: RegisterEvent( string )
Where string is an event (see RoM Wiki List of Eventsfor a list of events)
Example
XML Frame definition
	<Script file="MyExample.lua"/>
	<Frame name="MyExampleFrame" parent="UIParent" hidden="true">
		<Scripts>
			<OnLoad>
				MyExample_OnLoad(this)
			</OnLoad>
			<OnEvent>
				MyExample_OnEvent(this, event, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
			</OnEvent>
		</Scripts>
	</Frame>
LUA interpretation
function MyExample_OnLoad(this)
 this:RegisterEvent("VARIABLES_LOADED")
end
function MyExample_OnEvent(this, event, ...)
 ....
end
Category:Widget/API