lv_roller: add missing action handling
This commit is contained in:
@@ -351,6 +351,7 @@ static lv_res_t lv_roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign,
|
|||||||
if(id < 0) id = 0;
|
if(id < 0) id = 0;
|
||||||
if(id >= ext->ddlist.option_cnt) id = ext->ddlist.option_cnt - 1;
|
if(id >= ext->ddlist.option_cnt) id = ext->ddlist.option_cnt - 1;
|
||||||
ext->ddlist.sel_opt_id = id;
|
ext->ddlist.sel_opt_id = id;
|
||||||
|
if(ext->ddlist.action) ext->ddlist.action(roller);
|
||||||
}
|
}
|
||||||
else if(sign == LV_SIGNAL_RELEASED) {
|
else if(sign == LV_SIGNAL_RELEASED) {
|
||||||
/*If picked an option by clicking then set it*/
|
/*If picked an option by clicking then set it*/
|
||||||
@@ -362,6 +363,7 @@ static lv_res_t lv_roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign,
|
|||||||
if(id < 0) id = 0;
|
if(id < 0) id = 0;
|
||||||
if(id >= ext->ddlist.option_cnt) id = ext->ddlist.option_cnt - 1;
|
if(id >= ext->ddlist.option_cnt) id = ext->ddlist.option_cnt - 1;
|
||||||
ext->ddlist.sel_opt_id = id;
|
ext->ddlist.sel_opt_id = id;
|
||||||
|
if(ext->ddlist.action) ext->ddlist.action(roller);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,6 +71,17 @@ static inline void lv_roller_set_options(lv_obj_t * roller, const char * options
|
|||||||
*/
|
*/
|
||||||
void lv_roller_set_selected(lv_obj_t *roller, uint16_t sel_opt, bool anim_en);
|
void lv_roller_set_selected(lv_obj_t *roller, uint16_t sel_opt, bool anim_en);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a function to call when a new option is chosen
|
||||||
|
* @param roller pointer to a roller
|
||||||
|
* @param action pointer to a callback function
|
||||||
|
*/
|
||||||
|
static inline void lv_roller_set_action(lv_obj_t * roller, lv_action_t action)
|
||||||
|
{
|
||||||
|
lv_ddlist_set_action(roller, action);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the height to show the given number of rows (options)
|
* Set the height to show the given number of rows (options)
|
||||||
* @param roller pointer to a roller object
|
* @param roller pointer to a roller object
|
||||||
|
|||||||
Reference in New Issue
Block a user