What to try
Change the divider orientation in the source and rerun to compare its appearance.
Usage notes
Dividers group content visually rather than act as controls. Choose the orientation for the layout and avoid unnecessary focus stops.
Create through Screen
The Screen constructor returns a node ID. Pass that ID to Screen layout, state and event APIs. It is separate from the standalone control object documented below.
Native Xu setup fragment: call configure during initialization of an existing Screen. See the complete example for window creation, event dispatch and cleanup.
#ui/widgets
fn configure(screen $&widgets.Screen) int {
id := screen.divider(widgets.AXIS_HORIZONTAL) or >>
screen.place(id,24.0,24.0,320.0,80.0) or >>
<< id
}
($&Screen) divider
pub fn (s $&Screen) divider(axis int) int
Purpose
Create Divider in Screen and return the component node ID; throw on creation failure.
Parameters
s $&Screen- The
Screen instance used by this call (exclusive borrow).
axis int- axis (int)
Returns
int — component node ID for place and other Screen methods.
Placement, state and events
The application owns the component. Screen.place positions nodes; Screen.set_enabled and Screen.set_visible control availability and visibility. Present again after state changes, handle or errors, and keep topology changes outside paint callbacks. ToastHost uses its own queue API.
Action · Styles · UI lifecycle and styling guide
Screen.place · Screen.set_enabled · Screen.set_visible
Standalone control object API
These types and methods support applications that manage control objects, input and painting directly. Their receiver is a control object, not a Screen node ID. For Screen usage, use the constructor above and the Screen methods in the Widgets module.
(&Divider) clone
pub fn (value &Divider) clone() Divider
Purpose
Copy the control or style snapshot into an independent Divider value.
Parameters
value &Divider- The
Divider instance used by this call (borrow).
Returns
Divider — a value of this type
struct Divider
Purpose
Divider context or state structure.
Public fields
This type has no public fields.
See usage example
(&Divider) is_selectable
pub fn (div &Divider) is_selectable() bool
Purpose
Operation on &Divider: whether it is selectable.
Parameters
div &Divider- The
Divider instance used by this call (borrow).
Returns
bool — true or false
($&Divider) set_selectable
pub fn (div $&Divider) set_selectable(selectable bool)
Purpose
Operation on $&Divider: set selectable.
Parameters
div $&Divider- The
Divider instance used by this call (exclusive borrow).
selectable bool- selectable (bool)
Returns
This call does not return a value.
(&Divider) axis
pub fn (div &Divider) axis() int
Purpose
Execute axis on &Divider.
Parameters
div &Divider- The
Divider instance used by this call (borrow).
Returns
int — a value of this type
($&Divider) set_axis
pub fn (div $&Divider) set_axis(axis int) int
Purpose
Operation on $&Divider: set axis. Throws on failure; handle the error or propagate it to the caller.
Parameters
div $&Divider- The
Divider instance used by this call (exclusive borrow).
axis int- axis (int)
Returns
int — a value of this type
(&Divider) bounds
pub fn (div &Divider) bounds() layout.Rect
Purpose
Return the bounding Rectangle of the control or geometry.
Parameters
div &Divider- The
Divider instance used by this call (borrow).
Returns
layout.Rect — a value of this type
($&Divider) set_bounds
pub fn (div $&Divider) set_bounds(bounds &layout.Rect) int
Purpose
Operation on $&Divider: set bounds. Throws on failure; handle the error or propagate it to the caller.
Parameters
div $&Divider- The
Divider instance used by this call (exclusive borrow).
bounds &layout.Rect- bounds (read-only borrow; caller keeps the original; type &layout.Rect)
Returns
int — a value of this type
(&Divider) needs_paint
pub fn (div &Divider) needs_paint() bool
Purpose
Return whether the control needs repainting; call painted after painting to clear the flag.
Parameters
div &Divider- The
Divider instance used by this call (borrow).
Returns
bool — true or false
($&Divider) painted
pub fn (div $&Divider) painted()
Purpose
Acknowledge the painted frame and clear the dirty flag; this is not a query.
Parameters
div $&Divider- The
Divider instance used by this call (exclusive borrow).
Returns
This call does not return a value.
($&Divider) invalidate
pub fn (div $&Divider) invalidate()
Purpose
Invalidate the control area, requesting a repaint on next frame.
Parameters
div $&Divider- The
Divider instance used by this call (exclusive borrow).
Returns
This call does not return a value.
(&Divider) is_enabled
pub fn (div &Divider) is_enabled() bool
Purpose
Return whether the control is currently enabled.
Parameters
div &Divider- The
Divider instance used by this call (borrow).
Returns
bool — true or false
($&Divider) set_enabled
pub fn (div $&Divider) set_enabled(enabled bool)
Purpose
Operation on $&Divider: set enabled.
Parameters
div $&Divider- The
Divider instance used by this call (exclusive borrow).
enabled bool- enabled (bool)
Returns
This call does not return a value.
(&Divider) is_invalid
pub fn (div &Divider) is_invalid() bool
Purpose
Operation on &Divider: whether it is invalid.
Parameters
div &Divider- The
Divider instance used by this call (borrow).
Returns
bool — true or false
($&Divider) set_invalid
pub fn (div $&Divider) set_invalid(invalid bool)
Purpose
Operation on $&Divider: set invalid.
Parameters
div $&Divider- The
Divider instance used by this call (exclusive borrow).
invalid bool- invalid (bool)
Returns
This call does not return a value.
(&Divider) is_selected
pub fn (div &Divider) is_selected() bool
Purpose
Operation on &Divider: whether it is selected.
Parameters
div &Divider- The
Divider instance used by this call (borrow).
Returns
bool — true or false
($&Divider) set_selected
pub fn (div $&Divider) set_selected(selected bool)
Purpose
Operation on $&Divider: set selected.
Parameters
div $&Divider- The
Divider instance used by this call (exclusive borrow).
selected bool- selected (bool)
Returns
This call does not return a value.
(&Divider) visual_state
pub fn (div &Divider) visual_state() int
Purpose
Operation on &Divider: visual state.
Parameters
div &Divider- The
Divider instance used by this call (borrow).
Returns
int — a value of this type
(&Divider) has_style
pub fn (div &Divider) has_style() bool
Purpose
Operation on &Divider: whether it has style.
Parameters
div &Divider- The
Divider instance used by this call (borrow).
Returns
bool — true or false
(&Divider) style_or
pub fn (div &Divider) style_or(styles &Styles) ControlStyle
Purpose
Operation on &Divider: style or.
Parameters
div &Divider- The
Divider instance used by this call (borrow).
styles &Styles- styles (read-only borrow; caller keeps the original; type &Styles)
Returns
ControlStyle — a value of this type
($&Divider) set_style
pub fn (div $&Divider) set_style(style &ControlStyle) int
Purpose
Operation on $&Divider: set style. Throws on failure; handle the error or propagate it to the caller.
Parameters
div $&Divider- The
Divider instance used by this call (exclusive borrow).
style &ControlStyle- style (read-only borrow; caller keeps the original; type &ControlStyle)
Returns
int — a value of this type
($&Divider) clear_style
pub fn (div $&Divider) clear_style()
Purpose
Operation on $&Divider: clear style.
Parameters
div $&Divider- The
Divider instance used by this call (exclusive borrow).
Returns
This call does not return a value.
(&Divider) paint
pub fn (div &Divider) paint(frame $&draw.Frame,theme &Theme) int
Purpose
Paint the control visually onto the target canvas. Throws on failure; handle the error or propagate it to the caller.
Parameters
div &Divider- The
Divider instance used by this call (borrow).
frame $&draw.Frame- frame (exclusive borrow; may modify the original; type $&draw.Frame)
theme &Theme- theme (read-only borrow; caller keeps the original; type &Theme)
Returns
int — a value of this type
(&Divider) measure_styled
pub fn (div &Divider) measure_styled(styles &Styles) layout.Size
Purpose
Operation on &Divider: measure styled.
Parameters
div &Divider- The
Divider instance used by this call (borrow).
styles &Styles- styles (read-only borrow; caller keeps the original; type &Styles)
Returns
layout.Size — a value of this type
(&Divider) measure_labeled_styled
pub fn (div &Divider) measure_labeled_styled(label $&StyledLabel,styles &Styles) layout.Size
Purpose
Operation on &Divider: measure labeled styled. Throws on failure; handle the error or propagate it to the caller.
Parameters
div &Divider- The
Divider instance used by this call (borrow).
label $&StyledLabel- label (exclusive borrow; may modify the original; type $&StyledLabel)
styles &Styles- styles (read-only borrow; caller keeps the original; type &Styles)
Returns
layout.Size — a value of this type
(&Divider) paint_styled
pub fn (div &Divider) paint_styled(frame $&draw.Frame,styles &Styles) int
Purpose
Operation on &Divider: paint styled. Throws on failure; handle the error or propagate it to the caller.
Parameters
div &Divider- The
Divider instance used by this call (borrow).
frame $&draw.Frame- frame (exclusive borrow; may modify the original; type $&draw.Frame)
styles &Styles- styles (read-only borrow; caller keeps the original; type &Styles)
Returns
int — a value of this type
(&Divider) paint_labeled_styled
pub fn (div &Divider) paint_labeled_styled(frame $&draw.Frame,label $&StyledLabel,styles &Styles) int
Purpose
Operation on &Divider: paint labeled styled. Throws on failure; handle the error or propagate it to the caller.
Parameters
div &Divider- The
Divider instance used by this call (borrow).
frame $&draw.Frame- frame (exclusive borrow; may modify the original; type $&draw.Frame)
label $&StyledLabel- label (exclusive borrow; may modify the original; type $&StyledLabel)
styles &Styles- styles (read-only borrow; caller keeps the original; type &Styles)
Returns
int — a value of this type
Complete native example
Component Workshop · Back to Widgets