Struct native_windows_gui::TrackBar
source · [−]pub struct TrackBar {
pub handle: ControlHandle,
/* private fields */
}
Expand description
A trackbar is a window that contains a slider (sometimes called a thumb) in a channel, and optional tick marks. When the user moves the slider, using either the mouse or the direction keys, the trackbar sends notification messages to indicate the change.
Requires the trackbar
feature.
Builder parameters:
parent
: Required. The trackbar parent container.size
: The trackbar size.position
: The trackbar position.focus
: The control receive focus after being createdflags
: A combination of the TrackBarFlags values.ex_flags
: A combination of win32 window extended flags. Unlikeflags
, ex_flags must be used straight from winapirange
: The value range of the trackbarselected_range
: The selected value range of the trackbar. Used withTrackBarFlags::RANGE
pos
: The current value of the trackbarbackground_color
: The background color the of the trackbar
Control events:
OnVerticalScroll
: When the value of a trackbar with the VERTICAL flags is changedOnHorizontalScroll
: When the value of a trackbar with the HORIZONTAL flags is changedMousePress(_)
: Generic mouse press events on the buttonOnMouseMove
: Generic mouse mouse eventOnMouseWheel
: Generic mouse wheel event
use native_windows_gui as nwg;
fn build_trackbar(track: &mut nwg::TrackBar, window: &nwg::Window) {
nwg::TrackBar::builder()
.range(Some(0..100))
.pos(Some(10))
.parent(window)
.build(track);
}
Fields
handle: ControlHandle
Implementations
sourceimpl TrackBar
impl TrackBar
pub fn builder() -> TrackBarBuilder
sourcepub fn pos(&self) -> usize
pub fn pos(&self) -> usize
Retrieves the current logical position of the slider in a trackbar. The logical positions are the integer values in the trackbar’s range of minimum to maximum slider positions.
sourcepub fn selection_range_pos(&self) -> Range<usize>
pub fn selection_range_pos(&self) -> Range<usize>
Retrieves the starting and ending position of the current selection range in a trackbar.
Only work for trackbar with the Range
flags
sourcepub fn set_selection_range_pos(&self, value: Range<usize>)
pub fn set_selection_range_pos(&self, value: Range<usize>)
Sets the range value of the trackbar
Only work for trackbar with the Range
flags
sourcepub fn set_range_min(&self, min: usize)
pub fn set_range_min(&self, min: usize)
Sets the minium logical position for the slider in a trackbar.
sourcepub fn set_range_max(&self, max: usize)
pub fn set_range_max(&self, max: usize)
Sets the maximum logical position for the slider in a trackbar.
sourcepub fn tic_value(&self, index: usize) -> usize
pub fn tic_value(&self, index: usize) -> usize
Retrieves the logical position of a tick mark in a trackbar. The logical position can be any of the integer values in the trackbar’s range of minimum to maximum slider positions.
sourcepub fn enabled(&self) -> bool
pub fn enabled(&self) -> bool
Return 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
Return 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)
Set the position of the button 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
Trait Implementations
sourceimpl From<&TrackBar> for ControlHandle
impl From<&TrackBar> for ControlHandle
sourceimpl From<&mut TrackBar> for ControlHandle
impl From<&mut TrackBar> for ControlHandle
sourceimpl PartialEq<ControlHandle> for TrackBar
impl PartialEq<ControlHandle> for TrackBar
sourcefn eq(&self, other: &ControlHandle) -> bool
fn eq(&self, other: &ControlHandle) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourceimpl PartialEq<TrackBar> for ControlHandle
impl PartialEq<TrackBar> for ControlHandle
Auto Trait Implementations
impl !RefUnwindSafe for TrackBar
impl !Send for TrackBar
impl !Sync for TrackBar
impl Unpin for TrackBar
impl UnwindSafe for TrackBar
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more