2025-06-30 6:35 AM - edited 2025-06-30 6:50 AM
Hello, I need to use Touchgfx on a small CPU and I'm optimizing my code accordingly. However, in the code that Touchgfx Designer generates, I noticed something that I don't understand:
The Screen classes inherit from the ScreenBase classes.
The Screen classes are actually final, but they have virtual functions, which makes the compiler generate virtual tables for them. The same goes for the Listener classes. Does anyone have any ideas on this?
Best regards
Solved! Go to Solution.
2025-07-02 5:00 AM
Hello @Panchev68 ,
When you add a screen, there will be a screenViewBase cpp and hpp files created with virtual functions but also a ScreenView cpp and hpp file.
You should not modify the base file as they get regenerated, instead you should overwrite the virtual functions by adding code in the ScreenView files (not the base files).
Is the extra computation required to look at the function table really that impactful? I don't think so, we have been able to design GUI using STM32G0 already (but without FreeRTOS).
Regards,
2025-07-02 5:00 AM
Hello @Panchev68 ,
When you add a screen, there will be a screenViewBase cpp and hpp files created with virtual functions but also a ScreenView cpp and hpp file.
You should not modify the base file as they get regenerated, instead you should overwrite the virtual functions by adding code in the ScreenView files (not the base files).
Is the extra computation required to look at the function table really that impactful? I don't think so, we have been able to design GUI using STM32G0 already (but without FreeRTOS).
Regards,
2025-07-02 5:10 AM - edited 2025-07-02 6:56 AM
10 screens ~ -2Kb
I'm asking out of simple human curiosity. I hope I missed something in C++. This solution plus a few others worked for me.
Congratulations on the wonderful environment you provide.
Best regards