Function zng_wgt_input::focus::is_focused

source ·
pub fn is_focused(child: impl UiNode, state: impl IntoVar<bool>) -> impl UiNode
Expand description

P If the widget has keyboard focus.

This is only true if the widget itself is focused. Use is_focus_within to include focused widgets inside this one.

§Highlighting

This property is always true when the widget has focus, independent of what device moved the focus, usually when the keyboard is used a special visual indicator is rendered, a dotted line border is common, this state is called highlighting and is tracked by the focus manager. To implement such a visual you can use the is_focused_hgl property.

§Return Focus

Usually widgets that have a visual state for this property also have one for is_return_focus, a common example is the text-input widget that shows an emphasized border and blinking cursor when focused and still shows the emphasized border without cursor when a menu is open and it is only the return focus.