Struct native_windows_gui::CheckBox[][src]

pub struct CheckBox {
    pub handle: ControlHandle,
    // some fields omitted
}
Expand description

A check box consists of a square box and an application-defined labe that indicates a choice the user can make by selecting the button. Applications typically display check boxes to enable the user to choose one or more options that are not mutually exclusive.

CheckBox is not behind any features.

Builder parameters:

  • parent: Required. The checkbox parent container.
  • text: The checkbox text.
  • size: The checkbox size.
  • position: The checkbox position.
  • enabled: If the checkbox can be used by the user. It also has a grayed out look if disabled.
  • flags: A combination of the CheckBoxFlags values.
  • ex_flags: A combination of win32 window extended flags. Unlike flags, ex_flags must be used straight from winapi
  • font: The font used for the checkbox text
  • background_color: The background color of the checkbox. Defaults to the default window background (light gray)
  • check_state: The default check state
  • focus: The control receive focus after being created

Control events:

  • OnButtonClick: When the checkbox is clicked once by the user
  • OnButtonDoubleClick: When the checkbox is clicked twice rapidly by the user
  • MousePress(_): Generic mouse press events on the checkbox
  • OnMouseMove: Generic mouse mouse event
  • OnMouseWheel: Generic mouse wheel event
use native_windows_gui as nwg;
fn build_checkbox(button: &mut nwg::CheckBox, window: &nwg::Window, font: &nwg::Font) {
    nwg::CheckBox::builder()
        .text("Hello")
        .flags(nwg::CheckBoxFlags::VISIBLE)
        .font(Some(font))
        .parent(window)
        .build(button);
}

Fields

handle: ControlHandle

Implementations

Return true if the checkbox can have a third state or false otherwise

Sets or unsets the checkbox as tristate

Return the check state of the check box

Sets the check state of the check box

Return the font of the control

Set the font of the control

Return true if the control currently has the keyboard focus

Set the keyboard focus on the button.

Return true if the control user can interact with the control, return false otherwise

Enable or disable the control

Return true if the control is visible to the user. Will return true even if the control is outside of the parent client view (ex: at the position (10000, 10000))

Show or hide the control to the user

Return the size of the check box in the parent window

Set the size of the check box in the parent window

Return the position of the check box in the parent window

Set the position of the check box in the parent window

Return the check box label

Set the check box label

Winapi class name used during control creation

Winapi base flags used during window creation

Winapi flags required by the control

Trait Implementations

Returns the “default value” for a type. Read more

Executes the destructor for this type. Read more

Performs the conversion.

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.