Hi!
I started testing GUI Guider version 2, and I found a couple of issues (starting with an empty template, Windows simulator).
I started defining the content of the top layer putting an image button, creating an event handler to switch state when the button is long pressed.
The generated the code has some errors, like:
gg_event_layer_top.c:
static void lv_layer_top()_event_handler(lv_event_t * e) {
...
}
(parenthesis create a parsing error)
Manually removing the parenthesis, the error below is generated:
.../generated/events/gg_event_layer_top.c:59:38: error: 'gg_layer_top_t' has no member named 'lv_layer_top'
(gg_layer_top_t definition doesn't include that member)
Am I missing some definition to make a correct generation of those functions?
Hi @poldo
May i ask how can i reproduce this issue?
BR
Harry
Hi @Harry_Zhang , thank you for your reply.
This is what I did:
- On layer_top (clickable flag added, is this necessary?) I created a container for my buttons (no clickable flag added)
- Inside the container I created an image button (clickable flag added)
- I attached the event "Long Pressed" to the button
Generated code contains the syntax errors above.
// In gg_event_layer_top.c
static void lv_layer_top()_event_handler(lv_event_t * e)
{
gg_ui_t * ui = lv_event_get_user_data(e);
lv_event_code_t code = lv_event_get_code(e);
switch(code) {
default:
break;
}
}
void gg_event_init_layer_top(gg_ui_t * ui)
{
lv_obj_add_event_cb(ui->layer_top.lv_layer_top(), lv_layer_top()_event_handler, LV_EVENT_ALL, ui);
lv_obj_add_event_cb(ui->layer_top.Keypad_btnEnable, Keypad_btnEnable_event_handler, LV_EVENT_ALL, ui);
}Removing the parenthesis the syntax error is about the member lv_layer_top not existing:
// In custom.h
typedef struct {
lv_obj_t * Keypad;
lv_obj_t * Keypad_btnEnable;
} gg_layer_top_t;BR
Poldo
Hi @poldo
I tried to reproduce this issue.
The generated code is correct.
May I ask what I missed?
BR
Harry
Hi @Harry_Zhang .
The issue is when you create objects on the top layr. I'm attaching my file for your review and test.
Hi @poldo
Thanks for your project, we have reproduced this issue.
This is a bug.
We will fix it in the next version.
Thank you for your understanding.
BR
Harry
Thank you, @Harry_Zhang .
Is there a workaround that could be used while waiting for the update?
BR
This is a bug, and the fix is simple. Find your guiguider file and open it in text mode. Locate the event_list, remove any extra content, and then use the guider to reload the project. The generated code will return to normal.