pub struct ComboBox(/* private fields */);
Available on crate feature
gui
only.Expand description
Native combo box control.
Implementations§
source§impl ComboBox
impl ComboBox
sourcepub fn new(parent: &impl GuiParent, opts: ComboBoxOpts) -> Self
pub fn new(parent: &impl GuiParent, opts: ComboBoxOpts) -> Self
Instantiates a new ComboBox
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 a ComboBox
in an event closure.
§Examples
use winsafe::{self as w, prelude::*, gui};
let wnd: gui::WindowMain; // initialized somewhere
let cmb = gui::ComboBox::new(
&wnd,
gui::ComboBoxOpts {
position: (10, 10),
width: 140,
items: vec![
"Avocado".to_owned(),
"Banana".to_owned(),
"Grape".to_owned(),
"Orange".to_owned(),
],
selected_item: Some(0),
..Default::default()
},
);
sourcepub fn new_dlg(
parent: &impl GuiParent,
ctrl_id: u16,
resize_behavior: (Horz, Vert)
) -> Self
pub fn new_dlg( parent: &impl GuiParent, ctrl_id: u16, resize_behavior: (Horz, Vert) ) -> Self
Instantiates a new ComboBox
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 a ComboBox
in an event closure.
sourcepub const fn items(&self) -> ComboBoxItems<'_>
pub const fn items(&self) -> ComboBoxItems<'_>
Item methods.
Trait Implementations§
source§impl GuiChildFocus for ComboBox
impl GuiChildFocus for ComboBox
source§fn focus(&self)
fn focus(&self)
In a raw, ordinary window, simply calls
HWND:SetFocus
. Read moresource§impl GuiNativeControl for ComboBox
impl GuiNativeControl for ComboBox
source§fn on_subclass(&self) -> &WindowEvents
fn on_subclass(&self) -> &WindowEvents
Exposes the subclass events. If at least one event exists, the control
will be
subclassed. Read more
source§impl GuiNativeControlEvents<ComboBoxEvents> for ComboBox
impl GuiNativeControlEvents<ComboBoxEvents> for ComboBox
source§fn on(&self) -> &ComboBoxEvents
fn on(&self) -> &ComboBoxEvents
Exposes the specific control events. Read more
source§impl GuiWindowText for ComboBox
impl GuiWindowText for ComboBox
source§fn set_text(&self, text: &str)
fn set_text(&self, text: &str)
Sets the text by calling
HWND::SetWindowText
.source§fn text(&self) -> String
fn text(&self) -> String
Retrieves the text by calling
HWND::GetWindowText
.impl Send for ComboBox
Auto Trait Implementations§
impl Freeze for ComboBox
impl !RefUnwindSafe for ComboBox
impl !Sync for ComboBox
impl Unpin for ComboBox
impl !UnwindSafe for ComboBox
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more