DVUI

KeyboardNavigation

Adds keyboard navigation to the grid Provides a "cursor" that can be moved using keyboard bindings. Usage:

  • The struct instance must be persisted accross frames.
  • Call setLimits() if the size of the grid could have changed.
  • Call processEvents() prior to creating any grid body cells.
  • Call cellCusor() to find the currently focused cell.
  • Use shouldFocus() to determine whether to focus the widget within the focused cell. shouldFocus() will return false when nothing inside the grid has focus. e.g. the user clicked oustide the grid.
  • Call endGrid() after all grid body cells have been created.

Fields

#
wrap_cursor:bool

Should the cursor wrap to the next row at the end of a column.

tab_out:bool

Should we tab out of the grid at when shift-tab/tab is pressed in the first/last row_col.

num_scroll:isize

Number of rows to move the cursor up/down on scroll_up/scroll_down

num_cols:usize

col_num will always be less than this value.

num_rows:usize

row_num will always be less than this value.

navigation_keys:NavigationKeys

Customize navigation keys

is_focused:bool

Cursor should only be used if the grid or children have focus.

cursor:Cell

result cursor. using cellCursor() is preferred.

last_focused_widget:Id

Internal use.

Types

#
NavigationKeys

Direction keys.

Functions

#
processEvents

Call this once per frame before the grid body cells are created.

processEventsCustom

Call this once per frame before the grid body cells are created.

gridEnd

Must be called after all body cells are created.

numScrollDefault

Calculate the number of rows to scroll based on the

setLimits

Change max row and col limits

scrollTo

Move the cursor to the specified col and row.

scrollBy

Scroll by a col and/or row offset. Accepts +ve and -ve offset.

cellCursor

returns the current cursor

shouldFocus

Should the widget in cellCursor() be focused this frame?