diff --git a/packages/project-editor/lvgl/build.ts b/packages/project-editor/lvgl/build.ts index 15ff8d92..e52721e5 100644 --- a/packages/project-editor/lvgl/build.ts +++ b/packages/project-editor/lvgl/build.ts @@ -467,6 +467,19 @@ export class LVGLBuild extends Build { `void *flowState = lv_event_get_user_data(e);` ); + build.line(""); + + if (widget.hasEventHandler) { + widget.buildEventHandler(build); + } + + if ( + widget.eventHandlers.length > 0 && + widget.hasEventHandler + ) { + build.line(""); + } + for (const eventHandler of widget.eventHandlers) { if ( eventHandler.eventName == "CHECKED" || @@ -537,10 +550,6 @@ export class LVGLBuild extends Build { build.line("}"); } - if (widget.hasEventHandler) { - widget.buildEventHandler(build); - } - build.unindent(); build.line("}"); build.line(""); diff --git a/packages/project-editor/lvgl/widgets/Base.tsx b/packages/project-editor/lvgl/widgets/Base.tsx index 49f3a7e6..8b58fe38 100644 --- a/packages/project-editor/lvgl/widgets/Base.tsx +++ b/packages/project-editor/lvgl/widgets/Base.tsx @@ -751,7 +751,7 @@ export class LVGLWidget extends Widget { propertyGridGroup: generalGroup, hideInPropertyGrid: (widget: LVGLWidget) => ProjectEditor.getProject(widget).lvglGroups.groups.length == - 0 + 0 || widget instanceof LVGLScreenWidget }, { name: "groupIndex", diff --git a/packages/project-editor/lvgl/widgets/Screen.tsx b/packages/project-editor/lvgl/widgets/Screen.tsx index 526b67ca..83bf0a4e 100644 --- a/packages/project-editor/lvgl/widgets/Screen.tsx +++ b/packages/project-editor/lvgl/widgets/Screen.tsx @@ -144,7 +144,7 @@ export class LVGLScreenWidget extends LVGLWidget { ProjectEditor.PageClass.classInfo ) as Page; - build.line("if (event == LV_EVENT_SCREEN_LOADED) {"); + build.line("if (event == LV_EVENT_SCREEN_LOAD_START) {"); build.indent(); for (const group of allGroups) {