2023-12-12 09:12 AM
I'm am having trouble figuring out a good flow for using Designer and CUBE IDE to design a GUI. I am mostly using Designer (4.22) to draw graphics but can't seem to retain custom code when Designer generates code. For example, I am using the F769I-DISCO to do some development and added a circle with a ClickListener. What I want to do is change screens when a user clicks on the circle. Now, I know what code I need to add this feature and it does work but as soon as I generate code through Designer, my custom code gets deleted - how can I retain it?
I really can't built my GUI if this keeps happening, there must be a way for me to be able to use Designer in conjunction with CUBE IDE.
Solved! Go to Solution.
2023-12-13 04:54 AM
Hello @sergiog ,
I have just tried opening one of my project in CubeIDE, adding something in it and then generating the code from Designer. My code stayed.
1.
Have you tried with another IDE / text editor?
If yes, did it work fine?
2.
What is the name of the file in which you put your code in?
Designer generated different folders including the folder "generated" and "gui" :
- generated : the code generated by Designer, it is the base code that is created when you add buttons, triggers, interactions, images, etc in Designer. The files theres ends by "Base.cpp" and they should not be modified as they are overwrote when generating the code.
- gui : contains the files referencing your different screens, containers, model, etc. This is where you put your animations and other.
My guess is that you put your code in the base files instead of putting it in the gui files.
Hope this helps.
Don’t hesitate to give us a feedback or give more precisions and tell us if the issue is solved! :smiling_face_with_smiling_eyes:
2023-12-13 04:54 AM
Hello @sergiog ,
I have just tried opening one of my project in CubeIDE, adding something in it and then generating the code from Designer. My code stayed.
1.
Have you tried with another IDE / text editor?
If yes, did it work fine?
2.
What is the name of the file in which you put your code in?
Designer generated different folders including the folder "generated" and "gui" :
- generated : the code generated by Designer, it is the base code that is created when you add buttons, triggers, interactions, images, etc in Designer. The files theres ends by "Base.cpp" and they should not be modified as they are overwrote when generating the code.
- gui : contains the files referencing your different screens, containers, model, etc. This is where you put your animations and other.
My guess is that you put your code in the base files instead of putting it in the gui files.
Hope this helps.
Don’t hesitate to give us a feedback or give more precisions and tell us if the issue is solved! :smiling_face_with_smiling_eyes:
2023-12-13 10:34 AM
You are correct. I was modifying the base files. I guess the problem is that I was following an example online that modified the base file instead of the user view file. I've actually come across a few example that do this so I wonder if other people also do not understand the touchgfx code structure. Thanks, I'll keep this in mind in the future.
2023-12-14 12:34 AM
I am glad you found the issue!
Here are 2 playlists of video guide made by ST :
- Playlist 1
- Playlist 2
There is a disclaimer at the top of each base file, maybe we should make it more visible to not modify it, thank you for the feedback.