<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.returnofreckoning.com/index.php?action=history&amp;feed=atom&amp;title=API%3AWindowRegisterCoreEventHandler</id>
	<title>API:WindowRegisterCoreEventHandler - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.returnofreckoning.com/index.php?action=history&amp;feed=atom&amp;title=API%3AWindowRegisterCoreEventHandler"/>
	<link rel="alternate" type="text/html" href="https://wiki.returnofreckoning.com/index.php?title=API:WindowRegisterCoreEventHandler&amp;action=history"/>
	<updated>2026-10-18T16:17:50Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://wiki.returnofreckoning.com/index.php?title=API:WindowRegisterCoreEventHandler&amp;diff=30888&amp;oldid=prev</id>
		<title>Maintenance script: UI Lua API import (WAR 1.4.8)</title>
		<link rel="alternate" type="text/html" href="https://wiki.returnofreckoning.com/index.php?title=API:WindowRegisterCoreEventHandler&amp;diff=30888&amp;oldid=prev"/>
		<updated>2026-10-16T19:51:44Z</updated>

		<summary type="html">&lt;p&gt;UI Lua API import (WAR 1.4.8)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{LuaApi|group=Window}}&lt;br /&gt;
Sets the Lua function that a window calls for one of its own (core) events, such as a mouse click.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WindowRegisterCoreEventHandler(windowName, eventName, functionName)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Arguments ==&lt;br /&gt;
;windowName : &amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; – Name of the window.&lt;br /&gt;
;eventName : &amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; – Name of the core event, for example &amp;lt;code&amp;gt;&amp;quot;OnLButtonUp&amp;quot;&amp;lt;/code&amp;gt;. See the list below.&lt;br /&gt;
;functionName : &amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; – Name of the Lua function to call, as a dotted path such as &amp;lt;code&amp;gt;&amp;quot;MyAddon.OnClick&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Returns ==&lt;br /&gt;
Nothing.&lt;br /&gt;
&lt;br /&gt;
== Details ==&lt;br /&gt;
* These are the core event names in the client&amp;#039;s event table:&lt;br /&gt;
** &amp;lt;code&amp;gt;OnInitialize&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OnInitializeCustomSettings&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OnShutdown&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OnUpdate&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;OnLButtonDown&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OnLButtonUp&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OnLButtonDblClk&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OnRButtonDown&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OnRButtonUp&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OnRButtonDblClk&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OnMButtonDown&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OnMButtonUp&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OnMButtonDblClk&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;OnMouseOver&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OnMouseOverEnd&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OnMouseDrag&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OnMouseWheel&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;OnKeyEnter&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OnKeyTab&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OnKeyEscape&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OnRawDeviceInput&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OnGamepadInput&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;OnShown&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OnHidden&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OnSizeUpdated&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OnSetMoving&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;OnHyperLinkLButtonDown&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OnHyperLinkLButtonUp&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OnHyperLinkRButtonDown&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OnHyperLinkRButtonUp&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OnHyperLinkMButtonDown&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OnHyperLinkMButtonUp&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OnHyperLinkMouseOver&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OnHyperLinkMouseOverEnd&amp;lt;/code&amp;gt;&lt;br /&gt;
* The call fails &amp;#039;&amp;#039;&amp;#039;silently&amp;#039;&amp;#039;&amp;#039; (no error) when:&lt;br /&gt;
** &amp;lt;code&amp;gt;eventName&amp;lt;/code&amp;gt; is not a known core event name,&lt;br /&gt;
** &amp;lt;code&amp;gt;eventName&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;functionName&amp;lt;/code&amp;gt; is empty, or&lt;br /&gt;
** the window already has a handler for that event. The old handler stays. Remove it first with [[API:WindowUnregisterCoreEventHandler|WindowUnregisterCoreEventHandler]].&lt;br /&gt;
* Window XML sets the same handlers with &amp;lt;code&amp;gt;&amp;amp;lt;EventHandler event=&amp;quot;OnLButtonUp&amp;quot; function=&amp;quot;...&amp;quot; /&amp;amp;gt;&amp;lt;/code&amp;gt;. This function adds one at run time, for example to a window created from a template.&lt;br /&gt;
* For game events (&amp;lt;code&amp;gt;SystemData.Events.*&amp;lt;/code&amp;gt;) use [[API:WindowRegisterEventHandler|WindowRegisterEventHandler]] instead.&lt;br /&gt;
&lt;br /&gt;
== Errors ==&lt;br /&gt;
* &amp;lt;code&amp;gt;Error in function call &amp;#039;WindowRegisterCoreEventHandler&amp;#039;: Window %s does not exist&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
Making a context menu item react to clicks and mouse-over, from &amp;lt;code&amp;gt;ea_chatwindow/source/chatwindow.lua&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CreateWindowFromTemplate (&amp;quot;ChatWindowContextShowTimestamp&amp;quot;, &amp;quot;ChatContextMenuItemCheckBox&amp;quot;, &amp;quot;Root&amp;quot;)&lt;br /&gt;
LabelSetText( &amp;quot;ChatWindowContextShowTimestampCheckBoxLabel&amp;quot;, GetChatString( StringTables.Chat.LABEL_CHAT_TAB_TIMESTAMP ) )&lt;br /&gt;
WindowRegisterCoreEventHandler(&amp;quot;ChatWindowContextShowTimestamp&amp;quot;, &amp;quot;OnLButtonUp&amp;quot;, &amp;quot;EA_ChatWindow.ToggleTimestamp&amp;quot;)&lt;br /&gt;
WindowRegisterCoreEventHandler(&amp;quot;ChatWindowContextShowTimestamp&amp;quot;, &amp;quot;OnMouseOver&amp;quot;, &amp;quot;EA_Window_ContextMenu.OnMouseOverDefaultMenuItem&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[API:WindowUnregisterCoreEventHandler|WindowUnregisterCoreEventHandler]]&lt;br /&gt;
* [[API:WindowRegisterEventHandler|WindowRegisterEventHandler]]&lt;/div&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
</feed>