Module rstk::check_button

source ·
Expand description

Check button widget - displays text/image with an on/off widget. Executes a command when clicked.

Examples

The check button works like a regular button, except that it has a state.

The simplest check button has some text and a command - the command accepts a single boolean, which is the new state of the button:

let button_1 = rstk::make_check_button(&root);
button_1.text("Button label");
button_1.command(|value| { println!("button_1 now {}", value); });

Check buttons can also display images, with or without text, and how these are displayed can be controlled using compound. In the following example, a check button with both an image and text is set to show the image below the text:

let button_3 = rstk::make_check_button(&root);
button_3.image(&read_image("tcllogo.gif"));
button_3.text("Tcl Logo");
button_3.command(|state| { println!("Clicked button_3"); });
button_3.compound(rstk::Compound::Bottom);

The check button’s state can be changed or checked using the selected and is_selected methods.

Structs

Functions