Project settings add user include code

What do you want to achieve?

In GUI designer for example create event On Screen load start
and set property with project value. Now result into undefined error.
Required is line in ui.h #include “master.h”
Add this into project settings pls.

Do you see alternative options and workaround to achieve it?

Now i can only replace event with call function and do it all in event c file.

Mention some use cases

Init screen values …

Sorry, but I don’t really understand the issue.

Is the problem that you need to include a custom header file in ui_envet.h?

I need include custom lines in ui.h.

This lines can be one include or more plus one define or more…
Example as in TouchGFX but global for project

I think you can do this by adding a function instead of an event. This will generate a ui_events.c file where you can add your own code and it wont/shouldn’t be overwritten when generating.

I had a similar problem at the beginning of my project and opted to add manually the on event functions and do whatever is needed on what events I want. For me it was, I hope, a better way because I can have a different file for each screen, and not a huge c file, ui_events.c, with all the logic for all the screens (or calling another functions from the SLS generated functions)


Thanks Gabi,
i request new feature and not howtodo. I know your solution and report it as now workaround…
Your idea not help use in UI variables from project external files.

In project settings you can choose not to export ui_events.c:

This way you can implement the functions of “Call function” action anyhow you wish.

Sorry , but im disapointed. Your reply is …
I dont ask, i require textarea in project config , where i write any lines , that generator place into ui.h on every regenerate.
What i write here is my job, your is implement generation.

I see what you want but I think it’s not a good idea to allow writing code in the editor because

  • there is no syntax highlight
  • auto completion
  • you need to open the editor the edit the code

Instead we provide a way to write a code in an IDE where you write the rest of the code anyway.

Seems you dont require money , or you mean peaple will pay for product , that work …
I mean you dont understand, then last try explain.
You have project with init values stored and changed on every poweron. NOT in your static UI. On load screen need be showed this values and not stupid static, that need next update change with event onload func.
Then i simply place in gui element value " setstruct.slider1value " instead number 123 and this now result into error in compile = require add include in ui.h

Kis stop waste my time .

Exactly where you place “setstruct.slider1value” value?

  1. In ui.c when the label is created? If so its not a good idea as it will be overwritten by the next export.
  2. In ui_event.c in a SCREEN_LOAD? If so, why don’t you simply include whatever you need at the beginning of ui_events.c?
  3. Something else?

in designer on any input box, but yes now is impossible enter instead number but i do it on some place i now dont remember where,

I rememmber i try this in events
result to error then i replace with call function

You can write any character e.g. for an Label but it will be interpreted as string.

I see your problem now. We are working a proper solution for it, but for now, it can be handled manually after calling ui_init() in code.

I still mean place user code is helpfull. For example for use defined consts instead values… Too enable enter it in designer input box . I dont analyze how lvgl switch between screens, but UI_Init is not help here.

Our next goal is to make it easier to create an API for the UI and set default values. I hope it will solve your issues too.