cancel
Showing results for 
Search instead for 
Did you mean: 

How to save my (user) code through "code generation"s in TouchGFX ?

GSerg.1
Associate II

Hi.

Is there any way to save my code in TouchGFX ?

Im creating a new project, composing my UI, setting up the actions (writing my own handlers) in ...Base.hpp and ...Base.cpp files.

But if i want to add some additional UI elements in my project, im "generating code" again, and ALL MY OWN HANDLERS ARE succesfully 🙂 DELETED :(.

Thus, how to save my editions through these "code generations" ?

3 REPLIES 3
MM..1
Chief II

Base files is in generated folders and is not desired for user edit. Your handler need be placed in files desired for edit for example all in gui folder.

Its ok, but, unfortunately, handler function which is created by touchgfx is placed exactly in base classes. The final class (derived by public access from these base classes) has no access to these protected members. Moreover, if i have added, for example, a TextArea into Screen, its inaccessible in derived class, but is accessible in base class.

Hi,

Could you give a more concrete example of one of your handlers and what you are trying to do ? Like MM said the whole idea behind the generated folder is that the user cannot modify it to prevent people from breaking it, and therfor do all your user code in the /gui folder. A bit confused by what you are saying with the textarea , whenever you want to modify a textArea from a screen called Screen1 you just have to do it in Screen1View which inherits from Screen1ViewBase. Same for the handlers. I might also just misunderstanding completely what files you are talking about with "derived class" and sorry then 😅.

You can also create the handlers in the view.hpp as well, like in this example Alexandre made a while back. Look at it and see if you can apply the same logic in your project.

/Romain