<?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%3ALCDSetButtonHandler</id>
	<title>API:LCDSetButtonHandler - 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%3ALCDSetButtonHandler"/>
	<link rel="alternate" type="text/html" href="https://wiki.returnofreckoning.com/index.php?title=API:LCDSetButtonHandler&amp;action=history"/>
	<updated>2026-10-17T11:51:28Z</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:LCDSetButtonHandler&amp;diff=30539&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:LCDSetButtonHandler&amp;diff=30539&amp;oldid=prev"/>
		<updated>2026-10-16T19:46:12Z</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=LCD}}&lt;br /&gt;
Registers a Lua function that an LCD page calls when one of the LCD&amp;#039;s four soft buttons is pressed or released.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LCDSetButtonHandler(pageName, callbackName)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Arguments ==&lt;br /&gt;
;pageName : &amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; – Name of the page.&lt;br /&gt;
;callbackName : &amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; – Name of the Lua function to call, for example &amp;lt;code&amp;gt;&amp;quot;EA_LCDKeyboard.HandleLCDButton&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;
* The handler is called as &amp;lt;code&amp;gt;callback(button, down)&amp;lt;/code&amp;gt;:&lt;br /&gt;
** &amp;lt;code&amp;gt;button&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt;) – the soft button, 1 to 4.&lt;br /&gt;
** &amp;lt;code&amp;gt;down&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;boolean&amp;lt;/code&amp;gt;) – &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; when the button is pressed, &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; when it is released.&lt;br /&gt;
* Each page can have one button handler. If the page already has one, the error below is logged and the old handler stays. Remove it first with [[API:LCDUnsetButtonHandler|LCDUnsetButtonHandler]].&lt;br /&gt;
* The function needs at least two arguments and only reads the last two.&lt;br /&gt;
&lt;br /&gt;
== Errors ==&lt;br /&gt;
* &amp;lt;code&amp;gt;Error in function call &amp;#039;LCDSetButtonHandler&amp;#039;: Page &amp;#039;%s&amp;#039; does not exist.&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;Error in function call &amp;#039;LCDSetButtonHandler&amp;#039;: Page %s already has an button press handler (%s).&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
From &amp;lt;code&amp;gt;ea_lcdkeyboard/source/g15test.lua&amp;lt;/code&amp;gt;, which gives every page the same handler:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LCDSetButtonHandler( EA_LCDKeyboard.Page0, &amp;quot;EA_LCDKeyboard.HandleLCDButton&amp;quot; )&lt;br /&gt;
LCDSetButtonHandler( EA_LCDKeyboard.Page1, &amp;quot;EA_LCDKeyboard.HandleLCDButton&amp;quot; )&lt;br /&gt;
&lt;br /&gt;
function EA_LCDKeyboard.HandleLCDButton(button, down)&lt;br /&gt;
	if( down ) then&lt;br /&gt;
		if( button == 1 ) then&lt;br /&gt;
			LCDShowPage( EA_LCDKeyboard.Page1 )&lt;br /&gt;
		end&lt;br /&gt;
		-- ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[API:LCDUnsetButtonHandler|LCDUnsetButtonHandler]]&lt;br /&gt;
* [[API:LCDRegisterEventHandler|LCDRegisterEventHandler]]&lt;br /&gt;
* [[API:LCDShowPage|LCDShowPage]]&lt;/div&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
</feed>