• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Swiping between screens On a CYD

Q&A Forum › Category: Other › Swiping between screens On a CYD
0 Vote Up Vote Down
Mike Parsons asked 7 months ago

Does the CYD allow gestures with LVGL? I have two working screens and I can switch between them with buttons, which is fine, but I’d much prefer to swipe between them. With the help of CoPilot, I’ve tried all kinds of stuff and have been unable to make the screen respond. I’d like to know if the CYD supports this behaviour, and if so, how do I enable it.
Thanks

3 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 7 months ago

Hi.
There are several elements that allow swiping. 
For example, when we have two tabs, we can click on the tab name, or swipe.
I think the sliders also allow you to swipe.
I guess it will depend on the element you’re trying to control.
 
Regards,
Sara

0 Vote Up Vote Down
Mike Parsons answered 7 months ago

In my main screen creation function, I have  the following  lines:
 
 lv_obj_add_flag(mainScreen, LV_OBJ_FLAG_GESTURE_BUBBLE);

  lv_obj_add_event_cb(mainScreen, mainScreen_gesture_cb, LV_EVENT_GESTURE, NULL);

  lv_obj_set_scroll_dir(mainScreen, LV_DIR_ALL);

Are they the correct settings to allow swiping? It does not respond at all.

0 Vote Up Vote Down
Sara Santos Staff answered 7 months ago

Hello Mike,
Take a look at this example:

void lv_example_tabview_1(void)
{
    /*Create a Tab view object*/
    lv_obj_t * tabview;
    tabview = lv_tabview_create(lv_screen_active());

    /*Add 3 tabs (the tabs are page (lv_page) and can be scrolled*/
    lv_obj_t * tab1 = lv_tabview_add_tab(tabview, "Tab 1");
    lv_obj_t * tab2 = lv_tabview_add_tab(tabview, "Tab 2");
    lv_obj_t * tab3 = lv_tabview_add_tab(tabview, "Tab 3");

    /*Add content to the tabs*/
    lv_obj_t * label = lv_label_create(tab1);
    lv_label_set_text(label, "This the first tab\n\n"
                      "If the content\n"
                      "of a tab\n"
                      "becomes too\n"
                      "longer\n"
                      "than the\n"
                      "container\n"
                      "then it\n"
                      "automatically\n"
                      "becomes\n"
                      "scrollable.\n"
                      "\n"
                      "\n"
                      "\n"
                      "Can you see it?");

    label = lv_label_create(tab2);
    lv_label_set_text(label, "Second tab");

    label = lv_label_create(tab3);
    lv_label_set_text(label, "Third tab");

    lv_obj_scroll_to_view_recursive(label, LV_ANIM_ON);

}

That code example when you swipe left or right, it moves to the next/previous tab in the screen.

I’ve been trying to look into the documation, and I think the swipe feature is activated by default in this tab example.

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New eBook Released] Learn ESP-IDF with ESP32: The Beginner’s Guide August 24, 2026
  • [eBook Updated] Smart Home with Raspberry Pi, ESP32, and ESP8266 Version 1.7 November 28, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2026 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.