# Class: ButtonGroup

### LuxModule: gui

A ButtonGroup is a list of Buttons that are informed when another button was pressed. A ButtonGroup has only one active button per time. The ButtonGroup is assigning ActionListeners to the buttons to receive calls on clickactions.

## Methods:

### Method overview:

- addButton
- click
- delete
- new
- onClicked
- remove

new ()
  returns: (ButtonGroup)
  creates a new Buttongroup
addButton (Button, fnOnPush, fnOnRelease, boolean toggle)
  returns: (Button)

  adds a button to the list. If this button is pushed or released (because another button was pressed), the corresponding functions are being called. The signature of the functions is:

       function react ([theclickedbutton], [previousbutton])

  You can use this functions to react on changes in the Buttongroup. Note that if the currently active button is pressed again, no event is generated here.

  If toggle is true, clicking the active element will deselect the group.

  This function makes the given button automaticly pushable.

       button:setPushable(true)

click (button)
  returns: ()
  called by the actionlisteners. Calls automaticly the assigned functiosn from the addButton function. Does nothing if the button is currently marked as active (and is pushed). Calling the click function with nil will deselect any button (except if you added the button as toggleable).
delete ()
  returns: ()
  deltes the group removing all the actionlisteners and so on
onClicked ([theclickedbutton],[previousbutton])
  returns: ()
  function that is called when a clickevent occured. This method does nothing and can be overloaded without consequence.
remove (button)
  returns: ()
  removes the button from the buttongroup