Difference between revisions of "LGUI2:button"

From Lavish Software Wiki
Jump to navigation Jump to search
Line 9: Line 9:
 
; A button element, with a 1 pixel thick white border around a black background containing a textblock.  
 
; A button element, with a 1 pixel thick white border around a black background containing a textblock.  
 
: When clicked, this button will execute the [[LavishScript]] code: <tt>MyController:HandleButton1</tt>
 
: When clicked, this button will execute the [[LavishScript]] code: <tt>MyController:HandleButton1</tt>
 +
: See [[LGUI2:LS1:lgui2eventargs|lgui2eventargs]] for an example controller with onMouseButtonMove
 
  {
 
  {
 
   "type": "button",
 
   "type": "button",

Revision as of 21:47, 2 July 2018

A LavishGUI 2 button element is a standard Content Container element, with the added behavior of accepting Keyboard Focus when clicked.

Defining a button element

A button element is a Content Container with no additional properties.

Clicks on buttons are handled with Event Handlers in the same way as clicks on all other elements. See Base Element events

Examples

A button element, with a 1 pixel thick white border around a black background containing a textblock.
When clicked, this button will execute the LavishScript code: MyController:HandleButton1
See lgui2eventargs for an example controller with onMouseButtonMove
{
  "type": "button",
  "name": "button1",
  "content": "My border has some text!",
  "borderBrush": {
    "color": [ 1.0, 1.0, 1.0 ]
  },
  "backgroundBrush": {
    "color": [ 0, 0, 0 ]
  },
  "borderThickness": 1
  "eventHandlers": {
    "onMouseButtonMove": ["method","MyController","HandleButton1"]
    }
  }
}