Skip to main content
MHase
Associate III
May 17, 2019
Question

TextArea / Can I creat my own class TextArea e.g. MyTextArea and then use this new class with the TouchGFX-Designer?

  • May 17, 2019
  • 3 replies
  • 711 views

..

This topic has been closed for replies.

3 replies

cameronf
Associate
May 17, 2019

In general no, there is no way to use custom classes/widgets in the designer. But if you're willing to do something a little unconventional you can do some preprocessor directive to swap all TextArea instances in the project with MyTextArea. This would require that MyTextArea have all the same public interfaces that TextArea does to not break the generated code. You can add the preprocessor directives shown below to TextArea.hpp top accomplish this. This is a little unrecommended to change any touchgfx source like this and it will not be obvious to anyone else unless it's heavily documented somewhere, but if there's some extra functionality you want on your project for all of a certain widget type to have I think it can be acceptable with accompanying documentation in the project.

#ifdef USING_MY_TEXT_AREA
 
#include "MyTextArea.hpp"
#define TextArea MyTextArea
 
#else
 
{ TextArea class implementation }
 
#endif

Martin KJELDSEN
Principal III
May 21, 2019

Hi @MHase​,

Like @Community member​ said, there's no option to "plug in" to the Designer to create your own widgets with custom properties (yet). The closest thing you'll get is a Custom Container. Can you tell us more about the scenario you're trying to achieve here? Are you looking to create for custom, re-usable components?

/Martin

Martin KJELDSEN
Principal III
May 21, 2019