Callbacks/Event Handling Help

Description

Hi all,
I started using littlevgl last week and im very pleased with what i have done in such a short time. ive been try for days to make a gui using gfx library and it was so tedious i searched for better ways and luckily found littlevgl.
First I’m not a pro programmer but i think i understand enough to get by. Building the GUI for me was made easy. I hope to complete this project im starting to enjoy. Please help. :blush:

More event handling sample codes/tutorial please.

What MCU/Processor/Board and compiler are you using?

ESP32 Dev Module

What do you want to achieve?

Some head up to make the GUI functional

What have you tried so far?

Code to reproduce

Just an example

static const char * btnmKB_map[]= {"1","2","3","\n", 
                                       "4","5","6","\n", 
                                       "7","8","9","\n", 
                                       "0","   ","\n",
                                       "X","Y","Z","\n", 
                                       "G","M","F","\n",
                                       "Send",""};
    lv_obj_t *btnmKB = lv_btnm_create(tab1,NULL);
    lv_btnm_set_map (btnmKB, btnmKB_map);
    lv_obj_set_size(btnmKB,100,240);
    lv_obj_align(btnmKB, NULL, LV_ALIGN_CENTER, -180,16);
 
    lv_obj_set_event_cb(btnmKB, [](lv_obj_t *obj, lv_event_t event) {
      if (event == LV_EVENT_CLICKED) {
        const char* txt = lv_btnm_get_active_btn_text(obj);
        printf("%s was pressed\n", txt);
        //send text to text area taGC
        //lv_ta_set_text(taGC, txt);
      }
    });

    lv_obj_t *taGC = lv_ta_create(tab1, NULL);
    lv_obj_set_size(taGC, 250,28);
    lv_obj_align(taGC, NULL, LV_ALIGN_CENTER, 0, -90);
    lv_ta_set_text(taGC, "");
   

Screenshot and/or video

Learn more events at

https://docs.littlevgl.com/en/html/overview/event.html

BTW. What is you TFT’s size ?

thanks a lot!

its is a 3.5" screen for raspberry pi. i got it working on an esp32 prior to knowing about littlevgl. :smiley:

Do you have a link for this TFT?

There are lots of them on AliExpress. Here’s one:

1 Like

Thank you. : D