pub struct NodeRef { /* private fields */ }Expand description
A handle to the node a view builds, set with .node_ref(…). It follows
the node: a view built again (by Show, For) sets it again, and it’s
None while nothing is built. It also focuses the node from code
(focus, select_text).
Implementations§
Source§impl NodeRef
impl NodeRef
pub fn get_untracked(&self) -> Option<NodeId>
Sourcepub fn focus(&self)
pub fn focus(&self)
Gives the control keyboard focus, as a click or Tab would: the
first field of a dialog, say, where the platform wouldn’t focus it
itself. Asked before the control is built (in a window’s
on_open), it’s focused once it is.
Sourcepub fn select_text(&self, range: Range<usize>)
pub fn select_text(&self, range: Range<usize>)
Focuses a text field or text area and selects these characters of
its text, counted as people see them: grapheme clusters, so an
accented letter or an emoji made of several code points is one
(text.graphemes(true), from the re-exported unicode_segmentation).
A file’s name without its extension, say, as file managers select
one to rename. Cut to the text’s end; other controls are only
focused. Asked before the field is built, it’s done once it is,
after its first text.