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

lv_example_grid_4.c (1217B)

      1 #include "../../lv_examples.h"
      2 #if LV_USE_GRID && LV_BUILD_EXAMPLES
      3 
      4 /**
      5  * Demonstrate track placement
      6  */
      7 void lv_example_grid_4(void)
      8 {
      9     static lv_coord_t col_dsc[] = {60, 60, 60, LV_GRID_TEMPLATE_LAST};
     10     static lv_coord_t row_dsc[] = {45, 45, 45, LV_GRID_TEMPLATE_LAST};
     11 
     12 
     13     /*Add space between the columns and move the rows to the bottom (end)*/
     14 
     15     /*Create a container with grid*/
     16     lv_obj_t * cont = lv_obj_create(lv_scr_act());
     17     lv_obj_set_grid_align(cont, LV_GRID_ALIGN_SPACE_BETWEEN, LV_GRID_ALIGN_END);
     18     lv_obj_set_grid_dsc_array(cont, col_dsc, row_dsc);
     19     lv_obj_set_size(cont, 300, 220);
     20     lv_obj_center(cont);
     21 
     22     lv_obj_t * label;
     23     lv_obj_t * obj;
     24     uint32_t i;
     25     for(i = 0; i < 9; i++) {
     26         uint8_t col = i % 3;
     27         uint8_t row = i / 3;
     28 
     29         obj = lv_obj_create(cont);
     30         /*Stretch the cell horizontally and vertically too
     31          *Set span to 1 to make the cell 1 column/row sized*/
     32         lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_STRETCH, col, 1,
     33                              LV_GRID_ALIGN_STRETCH, row, 1);
     34 
     35         label = lv_label_create(obj);
     36         lv_label_set_text_fmt(label, "%d,%d", col, row);
     37         lv_obj_center(label);
     38     }
     39 }
     40 
     41 #endif