Struct winsafe::gui::events::ButtonEvents [−][src]
pub struct ButtonEvents { /* fields omitted */ }
Expand description
Exposes button control notifications.
These event methods are just proxies to the
WindowEvents
of the parent window,
who is the real responsible for the child event handling.
You cannot directly instantiate this object, it is created internally by the control.
Implementations
BCN_DROPDOWN
notification.
Sent when the user clicks a drop down arrow on a button.
pub fn bcn_hot_item_change<F>(&self, func: F) where
F: Fn(&NMBCHOTITEM) -> BoxResult<()> + 'static,
pub fn bcn_hot_item_change<F>(&self, func: F) where
F: Fn(&NMBCHOTITEM) -> BoxResult<()> + 'static,
BCN_HOTITEMCHANGE
notification.
Notifies the button control owner that the mouse is entering or leaving the client area of the button control.
BN_CLICKED
command notification.
Sent when the user clicks a button.
Examples
use winsafe::{gui, BoxResult};
let btn: gui::Button; // initialized somewhere
btn.on().bn_clicked({
let btn = btn.clone(); // pass into the closure
move || -> BoxResult<()> {
println!("HWND: {}", btn.hwnd());
Ok(())
}
});
BN_DBLCLK
command notification.
Sent when the user double-clicks a button. This notification code is
sent automatically for
BS::USERBUTTON
,
BS::RADIOBUTTON
, and
BS::OWNERDRAW
buttons. Other button
types send only if they have the
BS::NOTIFY
style.
BN_KILLFOCUS
command notification.
Sent when a button loses the keyboard focus. The button must have
the BS::NOTIFY
style to send this
notification code.
BN_SETFOCUS
command notification.
Sent when a button receives the keyboard focus. The button must have
the BS::NOTIFY
style to send this
notification code.
pub fn nm_custom_draw<F>(&self, func: F) where
F: Fn(&NMCUSTOMDRAW) -> BoxResult<CDRF> + 'static,
pub fn nm_custom_draw<F>(&self, func: F) where
F: Fn(&NMCUSTOMDRAW) -> BoxResult<CDRF> + 'static,
NM_CUSTOMDRAW
notification.
Notifies about custom draw operations on the button.