refactor: rename cnt to count

This commit is contained in:
Gabor Kiss-Vamosi
2023-11-15 22:38:24 +01:00
parent 43a231cf5a
commit 235d580a51
52 changed files with 185 additions and 175 deletions

View File

@@ -23,7 +23,7 @@ static void event_handler(lv_event_t * e)
}
lv_obj_t * parent = lv_obj_get_parent(obj);
uint32_t i;
for(i = 0; i < lv_obj_get_child_cnt(parent); i++) {
for(i = 0; i < lv_obj_get_child_count(parent); i++) {
lv_obj_t * child = lv_obj_get_child(parent, i);
if(child == currentButton) {
lv_obj_add_state(child, LV_STATE_CHECKED);
@@ -64,7 +64,7 @@ static void event_handler_center(lv_event_t * e)
if(currentButton == NULL) return;
lv_obj_t * parent = lv_obj_get_parent(currentButton);
const uint32_t pos = lv_obj_get_child_cnt(parent) / 2;
const uint32_t pos = lv_obj_get_child_count(parent) / 2;
lv_obj_move_to_index(currentButton, pos);
@@ -99,7 +99,7 @@ static void event_handler_swap(lv_event_t * e)
const lv_event_code_t code = lv_event_get_code(e);
// lv_obj_t* obj = lv_event_get_target(e);
if((code == LV_EVENT_CLICKED) || (code == LV_EVENT_LONG_PRESSED_REPEAT)) {
uint32_t cnt = lv_obj_get_child_cnt(list1);
uint32_t cnt = lv_obj_get_child_count(list1);
for(int i = 0; i < 100; i++)
if(cnt > 1) {
lv_obj_t * obj = lv_obj_get_child(list1, rand() % cnt);

View File

@@ -13,7 +13,7 @@ def event_handler(e):
else:
currentButton = obj
parent = obj.get_parent()
for i in range( parent.get_child_cnt()):
for i in range( parent.get_child_conut()):
child = parent.get_child(i)
if child == currentButton:
child.add_state(lv.STATE.CHECKED)
@@ -51,7 +51,7 @@ def event_handler_center(e):
if currentButton == None:
return
parent = currentButton.get_parent()
pos = parent.get_child_cnt() // 2
pos = parent.get_child_conut() // 2
currentButton.move_to_index(pos)
currentButton.scroll_to_view(lv.ANIM.ON)
@@ -82,7 +82,7 @@ def event_handler_swap(e):
code = e.get_code()
obj = e.get_target_obj()
if code == lv.EVENT.CLICKED:
cnt = list1.get_child_cnt()
cnt = list1.get_child_conut()
for i in range(100):
if cnt > 1:
obj = list1.get_child(urandom.getrandbits(32) % cnt )

View File

@@ -71,8 +71,8 @@ void lv_example_table_2(void)
lv_obj_set_size(table, LV_SIZE_CONTENT, 200);
lv_table_set_col_width(table, 0, 150);
lv_table_set_row_cnt(table, ITEM_CNT); /*Not required but avoids a lot of memory reallocation lv_table_set_set_value*/
lv_table_set_col_cnt(table, 1);
lv_table_set_row_count(table, ITEM_CNT); /*Not required but avoids a lot of memory reallocation lv_table_set_set_value*/
lv_table_set_col_count(table, 1);
/*Don't make the cell pressed, we will draw something different in the event*/
lv_obj_remove_style(table, NULL, LV_PART_ITEMS | LV_STATE_PRESSED);