Difference between revisions of "LGUI2:button"

From Lavish Software Wiki
Jump to navigation Jump to search
(Created page with "A LavishGUI 2 button element is a standard LGUI2:Content Container element, with the added behavior of accepting Keyboard Focus when clicked. == Defining a button elemen...")
 
Line 7: Line 7:
  
 
== Examples ==
 
== 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: <tt>MyController:HandleButton1</tt>
 +
{
 +
  "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"]
 +
    }
 +
  }
 +
}
  
 
[[Category:LavishGUI 2]]
 
[[Category:LavishGUI 2]]
 
[[Category:LavishGUI 2 Elements]]
 
[[Category:LavishGUI 2 Elements]]
 
[[Category:LavishGUI 2 Bordered Elements]]
 
[[Category:LavishGUI 2 Bordered Elements]]

Revision as of 16:25, 26 June 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
{
  "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"]
    }
  }
}