button(x, y, bmapOn, bmapOff, bmapOver, functionClick, functionLeave, functionOver);

button_toggle(x, y, bmapOn, bmapOff, bmapOver, bmapOverOff, functionClick, functionLeave, functionOver);

button_radio(x, y, bmapOn, bmapOff, bmapOver, functionClick, functionLeave, functionOver);

Defines a push, toggle, or radio button, which can be switched on and off by clicking onto it.

Parameters:

x, y Position relative to the upper left edge of the panel. For detecting mouse events, the button must be completely inside the panel area (panel.size) or the panel background bitmap.
bmapOn Bmap displayed when the button is switched on; gives also the size of the button.
bmapOff Bmap displayed when the the button is switched off.
bmapOver Bmap displayed when the mouse is over the button.
bmapOverOff Bmap displayed when the mouse is over the switched off button.
functionClick Function executed when the mouse is left clicked over the button.
functionLeave Function executed when the mouse is released over the button or leaves the button.
functionOver Function executed when the mouse touches the button.

Remarks:

Example:

var toggletest = 0;


function toggle_var()
{
  toggletest = 1 - toggletest; // toggle between 1 and 0
}

PANEL* pTest =
{
  button_toggle(0,0,on_map,off_map,off_map,NULL,toggle_var,NULL,NULL);
}

See also:

PANEL, vslider, hslider, window, digits, needle, pan_setpos, pan_setbutton, button_state

► latest version online