class fltk::Button


Class Hierarchy

fltk::Widget
   |
   +----fltk::Button
           |
           +----fltk::CheckButton, fltk::LightButton, fltk::RepeatButton,
                fltk::ReturnButton, fltk::RoundButton

Include Files

#include <fltk/Button.h>

Description

Buttons generate callbacks when they are clicked by the user. You control exactly when and how by changing the values for type() and when().

Buttons can also generate callbacks in response to fltk::SHORTCUT events. The button can either have an explicit shortcut() value or a letter shortcut can be indicated in the label() with an '&' character before it. For the label shortcut it does not matter if Alt is held down, but if you have an input field in the same window, the user will have to hold down the Alt key so that the input field does not eat the event first as an fltk::KEY event.

Methods

fltk::Button::Button(int x, int y, int w, int h, const char *label = 0)

The constructor creates the button using the position, size, and label.

fltk::Button::~Button(void)

The destructor removed the button.

int fltk::Button::clear()

Same as value(0).

fltk::Box fltk::Button::down_box() const
void fltk::Button::down_box(fltk::Box bt)

The first form returns the current down box type, which is drawn when value() is non-zero.

The second form sets the down box type. The default value of 0 causes FLTK to figure out the correct matching down version of box().

int fltk::Button::set()

Same as value(1).

void fltk::Button::setonly()

Turns on this button and turns off all other radio buttons in the group (calling value(1) or set() does not do this).

uchar fltk::Button::type() const
void fltk::Button::type(uchar t)

The first form of type() returns the current button type, which can be one of: The second form sets the button type to t.

char fltk::Button::value() const
int fltk::Button::value(int)

The first form returns the current value (0 or 1). The second form sets the current value.

fltk::When fltk::Widget::when() const
void fltk::Widget::when(fltk::When w)

Controls when callbacks are done. The following values are useful, the default value is fltk::WHEN_RELEASE: