Struct native_windows_gui::Button [−][src]
pub struct Button { pub handle: ControlHandle, }
Expand description
A push button is a rectangle containing an application-defined text label.
Use ImageButton
if you need to have a button that ONLY contains an icon or a bitmap.
Button is not behind any features.
Builder parameters:
parent
: Required. The button parent container.text
: The button text.size
: The button size.position
: The button position.enabled
: If the button can be used by the user. It also has a grayed out look if disabled.flags
: A combination of the ButtonFlags values.ex_flags
: A combination of win32 window extended flags. Unlikeflags
, ex_flags must be used straight from winapifont
: The font used for the button textbitmap
: A bitmap to display next to the button text. If this value is set, icon is ignored.icon
: An icon to display next to the button textfocus
: The control receive focus after being created
Control events:
OnButtonClick
: When the button is clicked once by the userOnButtonDoubleClick
: When the button is clicked twice rapidly by the userMousePress(_)
: Generic mouse press events on the buttonOnMouseMove
: Generic mouse mouse eventOnMouseWheel
: Generic mouse wheel event
use native_windows_gui as nwg; fn build_button(button: &mut nwg::Button, window: &nwg::Window, font: &nwg::Font) { nwg::Button::builder() .text("Hello") .flags(nwg::ButtonFlags::VISIBLE) .font(Some(font)) .parent(window) .build(button); }
Fields
handle: ControlHandle
Implementations
Sets the bitmap image of the button. Replace the current bitmap or icon.
Set image
to None
to remove the image
Sets the bitmap image of the button. Replace the current bitmap or icon.
Set image
to None
to remove the image
Returns the current image in the button.
If the button has a bitmap, the value will be returned in bitmap
If the button has a icon, the value will be returned in icon
Returns true if the control user can interact with the control, return false otherwise
Enable or disable the control
Returns 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
Sets the position of the button in the parent window
Winapi class name used during control creation
Winapi flags required by the control
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Button
impl UnwindSafe for Button