6,447pages on
this wiki
Add New Page
Add New Page Comments0


LCDSetButtonHandler(page, callback)

  • string:page = The unique pagename which this handler is bound to
  • string:callback = A function which should be called if any of the 4 lcd buttons is pressed



This function sets the buttonhandler for a single page. Which buttonhandler is called is depending on the currently displayed page i.e.: If you got a "Page-A" and a "Page-B" and you call the function LCDSetButtonHandler("Page-A", "MyAddon.ButtonPressed"), and this MyAddon.ButtonPressed function will display "Page-B", if button 2 was pressed and "Page-A" if button 1 was pressed, then "Page-B" is shown if button 2 was pressed. If the user now presses button 1, nothing will happen, because the active page is now "Page-B", and the callback function MyAddon.ButtonPressed, will just get called if "Page-A" is displayed. So you have to register a buttonhandler for every single page, if the user should not get stucked on one of your pages.

The callback function also get two arguments: function MyAddon.ButtonHandler(button,down)

  • number:button = The number of the button pressed - left is 1, then 2, 3 and 4
  • boolean:down = If this button was pressed or released

Also on Fandom

Random Wiki