pub struct NumberSelect {
pub handle: ControlHandle,
/* private fields */
}
Expand description
A NumberSelect control is a pair of arrow buttons that the user can click to increment or decrement a value. NumberSelect is implemented as a custom control because the one provided by winapi really sucks.
Requires the number-select
feature.
Builder parameters:
parent
: Required. The number select parent container.value
: The default value of the number selectsize
: The number select size.position
: The number select position.enabled
: If the number select can be used by the user. It also has a grayed out look if disabled.flags
: A combination of the NumberSelectFlags values.font
: The font used for the number select text
Control events:
MousePress(_)
: Generic mouse press events on the buttonOnMouseMove
: Generic mouse mouse event
use native_windows_gui as nwg;
fn build_number_select(num_select: &mut nwg::NumberSelect, window: &nwg::Window, font: &nwg::Font) {
nwg::NumberSelect::builder()
.font(Some(font))
.parent(window)
.build(num_select);
}
Fields§
§handle: ControlHandle
Implementations§
Source§impl NumberSelect
impl NumberSelect
pub fn builder<'a>() -> NumberSelectBuilder<'a>
Sourcepub fn data(&self) -> NumberSelectData
pub fn data(&self) -> NumberSelectData
Returns inner data specifying the possible input of a number select See NumberSelectData for the possible values
Sourcepub fn set_data(&self, v: NumberSelectData)
pub fn set_data(&self, v: NumberSelectData)
Sets the inner data specifying the possible input of a number select. Also update the value display. See NumberSelectData for the possible values
Sourcepub fn enabled(&self) -> bool
pub fn enabled(&self) -> bool
Returns true if the control user can interact with the control, return false otherwise
Sourcepub fn set_enabled(&self, v: bool)
pub fn set_enabled(&self, v: bool)
Enable or disable the control
Sourcepub fn visible(&self) -> bool
pub fn visible(&self) -> bool
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))
Sourcepub fn set_visible(&self, v: bool)
pub fn set_visible(&self, v: bool)
Show or hide the control to the user
Sourcepub fn set_position(&self, x: i32, y: i32)
pub fn set_position(&self, x: i32, y: i32)
Sets the position of the control in the parent window
Sourcepub fn class_name(&self) -> &'static str
pub fn class_name(&self) -> &'static str
Winapi class name used during control creation
Sourcepub fn forced_flags(&self) -> u32
pub fn forced_flags(&self) -> u32
Winapi flags required by the control