What MCU/Processor/Board and compiler are you using?
NXP MIMXRT1160-EVK / MCUXpresso IDE
What LVGL version are you using?
GUI Guider-1.3.0
What do you want to achieve?
Get text from a roller popup window and put that text on a label in another window
There are two roller pop-up windows, and it is possible to put it in the label of another window in the first roller pop-up window, but when you put it in the label of another window in the second roller pop-up window, the value of the first label is changed as well.
What have you tried so far?
I tried to store the value in the structure global variable and put that value into the label, but when I read the second roller value and put it in the label, the value in the first roller value global variable was initialized to 0, so it seemed that the value could not be read. The value changes according to the value of the second roller.
Code to reproduce
Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.
The code block(s) should be formatted like:
/*You code here*/
//hearder file define
typedef struct{
char *label_current;
}sMAIN_CONTROL;
extern sMAIN_CONTROL g_MAIN_PROJ;
extern sMAIN_CONTROL g_MAIN_SECOND;
//events_init.c
sMAIN_CONTROL g_MAIN_PROJ, g_MAIN_SECOND;
//first roller_proj
static void roller_proj_event_handler(lv_obj_t * obj, lv_event_t event)
{
if(event == LV_EVENT_VALUE_CHANGED) {
char buf[32];
lv_roller_get_selected_str(guider_ui.set_projectile_roller_proj, buf, sizeof(buf));
*g_MAIN_PROJ.label_current = buf;*
/* go to main_home */
lv_obj_clean(lv_scr_act());
setup_scr_main_home(&guider_ui);
lv_scr_load(guider_ui.main_home);
}
}
//second roller_proj
static void roller_second_event_handler(lv_obj_t * obj, lv_event_t event)
{
if(event == LV_EVENT_VALUE_CHANGED) {
char second_buf[32];
lv_roller_get_selected_str(guider_ui.set_second_roller_proj, second_buf, sizeof(second_buf));
*g_MAIN_SECOND.label_current = second_buf;*
/* go to main_home */
lv_obj_clean(lv_scr_act());
setup_scr_main_home(&guider_ui);
lv_scr_load(guider_ui.main_home);
}
}
//setup_scr_main_home.c
void setup_scr_main_home(lv_ui *ui){
//LABEL - PROJ
//Write codes main_home_label_select_proj
ui->main_home_label_select_proj = lv_label_create(ui->main_home, NULL);
//lv_label_set_text(ui->main_home_label_select_proj, "aa");
/* set text - main home */
*lv_label_set_text(ui->main_home_label_select_proj, g_MAIN_PROJ.label_current);*
lv_label_set_long_mode(ui->main_home_label_select_proj, LV_LABEL_LONG_BREAK);
lv_label_set_align(ui->main_home_label_select_proj, LV_LABEL_ALIGN_CENTER);
//LABEL - SECOND
ui->main_home_label_select_second = lv_label_create(ui->main_home, NULL);
//lv_label_set_text(ui->main_home_label_select_second, "hello");
/* set text - main home */
*lv_label_set_text(ui->main_home_label_select_second, g_MAIN_SECOND.label_current);*
lv_label_set_long_mode(ui->main_home_label_select_second, LV_LABEL_LONG_BREAK);
lv_label_set_align(ui->main_home_label_select_second, LV_LABEL_ALIGN_CENTER);
}
Screenshot and/or video
If possible, add screenshots and/or videos about the current state.
strong text
When the button is pressed, it switches to the roller screen and
When a VALUED CHANGED event occurs on the roller screen, get the TXT in the roller and store it in a global variable, then return to the screen shot screen and try to change it to the TXT imported in the PROJ part