mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-21 06:53:01 +08:00
lv_group_add_obj: do not add teh object if already added to this group
This commit is contained in:
parent
b8f598112f
commit
e8fdac41a9
@ -119,12 +119,21 @@ void lv_group_add_obj(lv_group_t * group, lv_obj_t * obj)
|
|||||||
{
|
{
|
||||||
if(group == NULL) return;
|
if(group == NULL) return;
|
||||||
|
|
||||||
|
/*Do not add the object twice*/
|
||||||
|
lv_obj_t ** obj_i;
|
||||||
|
LV_LL_READ(group->obj_ll, obj_i) {
|
||||||
|
if((*obj_i) == obj) {
|
||||||
|
LV_LOG_INFO("lv_group_add_obj: the object is already added to this group");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*If the object is already in a group and focused then defocus it*/
|
/*If the object is already in a group and focused then defocus it*/
|
||||||
if(obj->group_p) {
|
if(obj->group_p) {
|
||||||
if(lv_obj_is_focused(obj)) {
|
if(lv_obj_is_focused(obj)) {
|
||||||
lv_group_refocus(obj->group_p);
|
lv_group_refocus(obj->group_p);
|
||||||
|
|
||||||
LV_LOG_INFO("group: assign object to an other group");
|
LV_LOG_INFO("lv_group_add_obj: assign object to an other group");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -493,7 +493,6 @@ static bool lv_btn_design(lv_obj_t * btn, const lv_area_t * mask, lv_design_mode
|
|||||||
*/
|
*/
|
||||||
static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
|
static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
|
||||||
{
|
{
|
||||||
|
|
||||||
lv_res_t res;
|
lv_res_t res;
|
||||||
|
|
||||||
/* Include the ancient signal function */
|
/* Include the ancient signal function */
|
||||||
@ -501,7 +500,6 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
|
|||||||
if(res != LV_RES_OK) return res;
|
if(res != LV_RES_OK) return res;
|
||||||
|
|
||||||
lv_btn_ext_t * ext = lv_obj_get_ext_attr(btn);
|
lv_btn_ext_t * ext = lv_obj_get_ext_attr(btn);
|
||||||
lv_btn_state_t state = lv_btn_get_state(btn);
|
|
||||||
bool tgl = lv_btn_get_toggle(btn);
|
bool tgl = lv_btn_get_toggle(btn);
|
||||||
|
|
||||||
if(sign == LV_SIGNAL_PRESSED) {
|
if(sign == LV_SIGNAL_PRESSED) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user