natiny_view_set_focus
void natiny_view_set_focus(NatinyView view);
Sets the program-wide input focus to one view. A press on a pickable view sets
the focus before its NATINY_VIEW_HOOK_MOUSE_DOWN callback runs.
Parameters
| Name | Type | Description |
|---|---|---|
view |
NatinyView |
Focusable view handle; 0, an invalid handle, or a non-focusable view clears the focus |
Example
/* Give a newly opened form an initial focus target. */
natiny_view_set_focus(first_field);
Notes
- Destroying or hiding the focused view or one of its ancestors clears the focus. Making the focused view or one of its ancestors non-focusable also clears it.
- While a view hook runs, input event and state getters return neutral values unless the focus is that view or one of its descendants. Pointer position and hover remain available.