pub struct UpDown(/* private fields */);
gui
only.Expand description
Native up-down control.
Note that if the UpDown
is created with
UDS::AUTOBUDDY
style, it takes the control
created immediately before the UpDown
as the buddy one, attaching the
UpDown
to it. This control should be an Edit
with
ES::NUMBER
style.
Implementations§
source§impl UpDown
impl UpDown
sourcepub fn new(parent: &impl GuiParent, opts: UpDownOpts) -> Self
pub fn new(parent: &impl GuiParent, opts: UpDownOpts) -> Self
Instantiates a new UpDown
object, to be created on the parent window
with
HWND::CreateWindowEx
.
§Panics
Panics if the parent window was already created – that is, you cannot
dynamically create an UpDown
in an event closure.
§Examples
In the example below, the UpDown
has
UDS::AUTOBUDDY
style by default, so it
will take the Edit
, which was created immediately
prior, as its buddy control. The UpDown
will automatically attach
itself to the Edit
.
use winsafe::{self as w, prelude::*, co, gui};
let wnd: gui::WindowMain; // initialized somewhere
let txt = gui::Edit::new(
&wnd,
gui::EditOpts {
edit_style: co::ES::AUTOHSCROLL | co::ES::NOHIDESEL | co::ES::NUMBER,
..Default::default()
},
);
let updn = gui::UpDown::new(
&wnd,
gui::UpDownOpts {
range: (0, 50),
..Default::default()
},
);
sourcepub fn new_dlg(parent: &impl GuiParent, ctrl_id: u16) -> Self
pub fn new_dlg(parent: &impl GuiParent, ctrl_id: u16) -> Self
Instantiates a new UpDown
object, to be loaded from a dialog
resource with
HWND::GetDlgItem
.
§Panics
Panics if the parent dialog was already created – that is, you cannot
dynamically create an UpDown
in an event closure.
sourcepub fn pos(&self) -> i32
pub fn pos(&self) -> i32
Retrieves the current position by sending an
udm::GetPos32
message.
sourcepub fn range(&self) -> (i32, i32)
pub fn range(&self) -> (i32, i32)
Retrieves the minimum and maximum position values by sending an
udm::GetRange32
message.
sourcepub fn set_pos(&self, pos: i32)
pub fn set_pos(&self, pos: i32)
Sets the current position by sending an
udm::SetPos32
message.
sourcepub fn set_range(&self, min: i32, max: i32)
pub fn set_range(&self, min: i32, max: i32)
Set the control range by sending an
udm::SetRange32
message.