mirror of
https://github.com/lvgl/lvgl.git
synced 2025-02-04 07:13:00 +08:00
example(tabview): fix tabview disable scrollig example
there is no animatin after selecting a tab by clicking anymore
This commit is contained in:
parent
3de61c76af
commit
9491c3ff6d
@ -1,21 +1,11 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_TABVIEW && LV_BUILD_EXAMPLES
|
||||
|
||||
static void scroll_begin_event(lv_event_t * e)
|
||||
{
|
||||
/*Disable the scroll animations. Triggered when a tab button is clicked */
|
||||
if(lv_event_get_code(e) == LV_EVENT_SCROLL_BEGIN) {
|
||||
lv_anim_t * a = lv_event_get_param(e);
|
||||
if(a) a->time = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void lv_example_tabview_2(void)
|
||||
{
|
||||
/*Create a Tab view object*/
|
||||
lv_obj_t * tabview;
|
||||
tabview = lv_tabview_create(lv_scr_act(), LV_DIR_LEFT, 80);
|
||||
lv_obj_add_event_cb(lv_tabview_get_content(tabview), scroll_begin_event, LV_EVENT_SCROLL_BEGIN, NULL);
|
||||
|
||||
lv_obj_set_style_bg_color(tabview, lv_palette_lighten(LV_PALETTE_RED, 2), 0);
|
||||
|
||||
|
@ -1,15 +1,6 @@
|
||||
def scroll_begin_event(e):
|
||||
|
||||
#Disable the scroll animations. Triggered when a tab button is clicked */
|
||||
if e.get_code() == lv.EVENT.SCROLL_BEGIN:
|
||||
a = lv.anim_t.__cast__(e.get_param())
|
||||
if a:
|
||||
a.time = 0
|
||||
|
||||
# Create a Tab view object
|
||||
tabview = lv.tabview(lv.scr_act(), lv.DIR.LEFT, 80)
|
||||
tabview.get_content().add_event_cb(scroll_begin_event, lv.EVENT.SCROLL_BEGIN, None)
|
||||
|
||||
tabview.set_style_bg_color(lv.palette_lighten(lv.PALETTE.RED, 2), 0)
|
||||
|
||||
tab_btns = tabview.get_tab_btns()
|
||||
|
Loading…
x
Reference in New Issue
Block a user