acid-drop

- Hacking the planet from a LilyGo T-Deck using custom firmware
git clone git://git.acid.vegas/acid-drop.git
Log | Files | Refs | Archive | README | LICENSE

gridnav.md (2404B)

      1 ```eval_rst
      2 .. include:: /header.rst
      3 :github_url: |github_link_base|/others/gridnav.md
      4 ```
      5 # Grid navigation
      6 
      7 Grid navigation (gridnav for short) is a feature that changes the currently focused child object as arrow keys are pressed.
      8 
      9 If the children are arranged into a grid-like layout then the up, down, left and right arrows move focus to the nearest sibling
     10 in the respective direction.
     11 
     12 It doesn't matter how the children are positioned, as only the current x and y coordinates are considered.
     13 This means that gridnav works with manually positioned children, as well as [Flex](/layouts/flex) and [Grid](/layouts/grid) layouts.
     14 
     15 Gridnav also works if the children are arranged into a single row or column.
     16 That makes it useful, for example, to simplify navigation on a [List widget](/widgets/extra/list).
     17 
     18 Gridnav assumes that the object to which gridnav is added is part of a [group](/overview/indev.html#groups).
     19 This way, if the object with gridnav is focused, the arrow key presses are automatically forwarded to the object
     20 so that gridnav can process the arrow keys.
     21 
     22 To move the focus to the next widget of the group use `LV_KEY_NEXT/PREV` or `lv_group_focus_next/prev()` or the `TAB` key on keyboard as usual.
     23 
     24 If the container is scrollable and the focused child is out of the view, gridnav will automatically scroll the child into view.
     25 
     26 ## Usage
     27 
     28 To add the gridnav feature to an object use `lv_gridnav_add(cont, flags)`.
     29 
     30 `flags` control the behavior of gridnav:
     31 - `LV_GRIDNAV_CTRL_NONE` Default settings
     32 - `LV_GRIDNAV_CTRL_ROLLOVER`  If there is no next/previous object in a direction,
     33 the focus goes to the object in the next/previous row (on left/right keys) or first/last row (on up/down keys
     34 - `LV_GRIDNAV_CTRL_SCROLL_FIRST` If an arrow is pressed and the focused object can be scrolled in that direction
     35 then it will be scrolled instead of going to the next/previous object.  If there is no more room for scrolling the next/previous object will be focused normally
     36 
     37 `lv_gridnav_remove(cont)` Removes gridnav from an object.
     38 
     39 ## Focusable objects
     40 
     41 An object needs to be clickable or click focusable (`LV_OBJ_FLAG_CLICKABLE` or `LV_OBJ_FLAG_CLICK_FOCUSABLE`)
     42 and not hidden (`LV_OBJ_FLAG_HIDDEN`) to be focusable by gridnav.
     43 
     44 
     45 ## Example
     46 
     47 ```eval_rst
     48 
     49 .. include:: ../../examples/others/gridnav/index.rst
     50 
     51 ```
     52 ## API
     53 
     54 
     55 ```eval_rst
     56 
     57 .. doxygenfile:: lv_gridnav.h
     58   :project: lvgl
     59 
     60 ```