Class Button

Superclasses :
gui::Toggle
gui::Component
Subclasses :
gui::CheckBox
gui::IconButton
gui::TextButton
Package :
gui

This is the parent class of the button classes, including checkboxes.

A Button produces a BUTTON_PRESS_EVENT when the button is depressed, and code BUTTON_RELEASE_EVENT when it is released, as well as an ACTION_EVENT.

By default, when a button holds the keyboard focus a dashed line appears just within the button. Then, when return is pressed an ACTION_EVENT is generated. The method Dialog.set_initial_focus() can be used to have the button have the focus when the dialog is first displayed.

Buttons also repeatedly produce a BUTTON_HELD_EVENT whilst they are held down, rather like a repeating keyboard press. The delay between the initial repeat event and subsequent repeat events is set in the parent dialog (see above).

Source

Class summary
Methods inherited from gui::Toggle
get_status() into_cbg() is_checked() set_parent_check_box_group(x)
Variables inherited from gui::Toggle
is_checked_flag parent_check_box_group
Methods inherited from lang::Object
clone(seen) equals(other, seen) get_class() get_class_name() get_id() hash_code(depth, seen) is_instance(name) to_string(depth, seen)
Methods inherited from gui::Component
accepts_focus() add(c, i) all_valid() can_drag(ev) can_drop(d) child_validated(c) clear_accepts_focus() clear_allow_drag() clear_allow_drop() clear_draw_border() clear_is_shaded() compute_absolutes() create_event_and_fire(type, param) display(buffer_flag) do_handle_event(e) do_shading(W) drag_event(d) drag_reset() end_drag(d, c) fatal(s) finally() find_accel(e) find_focus() fire_icon_events_on_mouse(p, e) firstly() generate_components() get_accel() get_cbwin_reference() get_children() get_cwin_reference() get_h_reference() get_parent() get_parent_buffer_win() get_parent_dialog() get_parent_dialog_reference() get_parent_win() get_w_reference() get_x_reference() get_y_reference() got_focus(e) in_region() init() invalidate() invoke_can_drag(ev) invoke_can_drop(d) invoke_drag_event(d) invoke_drag_reset() invoke_end_drag(d, c) is_attrib(s) is_dialog_open() is_hidden() is_shaded() is_ticking() is_unhidden() is_unshaded() keeps(e) lost_focus(e) parse_pos(total, s) remove(c) resize() retime_ticker(n) set_abs_coords(x, y) set_abs_size(w, h) set_accel(k) set_accepts_focus() set_align(x_align, y_align) set_allow_drag() set_allow_drop() set_attribs(x[]) set_attribs_list(l) set_draw_border() set_is_shaded() set_parent(c) set_parent_dialog(c) set_pos(x_spec, y_spec) set_size(w_spec, h_spec) set_ticker(n, d) set_tooltip(x) stop_ticker() toggle_draw_border() toggle_is_shaded() unique_end(x) unique_start() validate()
Variables inherited from gui::Component
accel accepts_focus_flag allow_drag_flag allow_drop_flag attribs cbwin children cwin draw_border_flag h h_spec has_focus is_shaded_flag parent parent_dialog ticker tooltip valid w w_spec x x_align x_spec y y_align y_spec
Methods inherited from util::SetFields
as_attrib(attr, val) attrib(a[]) cset_val(attr, val) field_error(s) int_val(attr, val) int_vals(attr, val, n) numeric_val(attr, val) numeric_vals(attr, val, n) set_fields(l) string_val(attr, val) string_vals(attr, val, n) test_flag(attr, val)
Methods inherited from util::Connectable
connect(obj, meth, type) disconnect(l) fire(type, param) fire_event(e)
Variables inherited from util::Connectable
listeners
Methods defined in this class
clear_is_checked() clear_no_keyboard() clear_toggles() go_down() go_up() handle_accel(e) handle_default(e) handle_drag(e) handle_event(e) handle_press(e) handle_release(e) initially() on_action(e) set_img(x) set_imgs(x, y) set_is_checked() set_label(x) set_no_keyboard() set_one(attr, val) set_parent_button_group(x) set_toggles() tick() toggle_is_checked()
Variables defined in this class
img_down img_h img_up img_w is_checked_flag is_down is_held label no_keyboard_flag parent_button_group parent_check_box_group repeat_delay toggles_flag

Method detail

clear_is_checked()

Overrides clear_is_checked() in gui::Toggle
Set the status to unchecked.
Source

clear_no_keyboard()

Clear the no keyboard behaviour (the default)
Source

clear_toggles()

Clear the toggles flag.
Source

go_down()

Source

go_up()

Source

handle_accel(e)

Overrides handle_accel(e) in gui::Component
Source

handle_default(e)

Source

handle_drag(e)

Source

handle_event(e)

Overrides handle_event(e) in gui::Component
Source

handle_press(e)

Source

handle_release(e)

Source

initially()

Overrides initially() in util::Connectable

on_action(e)

Source

set_img(x)

Set the image (if any) to the given string, which should be in Icon image format.
Parameters :
x - The image
Source

set_imgs(x, y)

Set the up/down images (if any) to the strings provided, which should be in Icon image format. The two images must have the same dimensions.
Parameters :
x - The up image
y - The down image
Source

set_is_checked()

Overrides set_is_checked() in gui::Toggle
Set the status to checked.
Source

set_label(x)

Set the label of the button, if any.
Parameters :
x - The label
Source

set_no_keyboard()

Invoking this method disables the keyboard control over the button described above. No dashed line will ever appear in the button display and return will have no effect on the button even if it has the focus.
Source

set_one(attr, val)

Overrides set_one(attr, val) in util::SetFields
Source

set_parent_button_group(x)

Source

set_toggles()

Set the button so that when it is pressed, it toggles between two states, as indicated by the is_checked flag.

Instances of Checkbox have this flag on by default, but TextButton and IconButton do not. When the flag is on, the latter classes indicate their checked status by showing the button as being "down".

Source

tick()

Overrides tick() in gui::Component
Source

toggle_is_checked()

Overrides toggle_is_checked() in gui::Toggle
Toggle the checked status of the button. This method, and the following two methods, may be inappropriate for non-toggle styles of button.
Source

Variable detail

img_down


img_h


img_up


img_w


is_checked_flag


is_down


is_held


label


no_keyboard_flag


parent_button_group


parent_check_box_group


repeat_delay


toggles_flag