cancel
Showing results for 
Search instead for 
Did you mean: 

Edit text and colours of TouchGFX application via toolchain

mids400
Associate III

Hello everyone,

Most of you have read my post here (I recommended reading it first before getting into this topic.

In short: I mentioned in the previous post that I want to design a new independet project based on TouchGFX lets call it (Toolchain or Graphical Custom Tool....etc) and this also based on the first application. So whatever i would change in the toolchain and then write its .bin file to the MCU then this change should somehow be applied to the first project and means here the texts or the colours whatever.

The first application already implemented and released but i would explain my idea below:

Toolchange.png

Now i would divide this topic into three parts 1. Images (which i already implemented) 2. Texts and 3. Colours.

1- Lets start with the texts part.. So we have too many text objects in the main project, but the customer only needs to change one text object using the tool. The problem is that we are using 4 different languages so i have two challenge:

- The first is how to write the changed text to the MCU using the generated new .bin file and apply the changes to the main project?

The only file for text database i found was generated by touchgfx and all texts for all languages were stored in an array, each text have start value and end value, additionally the start value of next text depends on the end value of the previous text. I mean it is very difficult or almost impossible to replace just one text in this array.

This is an example for the array where all the texts stored there:

 

TEXT_LOCATION_FLASH_PRAGMA
KEEP extern const touchgfx::Unicode::UnicodeChar texts_all_languages[] TEXT_LOCATION_FLASH_ATTRIBUTE = {
    0x42, 0x6f, 0x6f, 0x74, 0x6c, 0x6f, 0x61, 0x64, 0x65, 0x72, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x0, // @0 "Bootloader version"
    0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x0, // @19 "Version"
    0x31, 0x2e, 0x32, 0x2e, 0x32, 0x0, // @27 "1.2.2"
    0x31, 0x2e, 0x30, 0x0 // @33 "1.0"
};

 

 

Now, if I want to change the text "Version", I should replace the hexa values with a new value, which I don't know how long it would be!

 

0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x0, // @19 "Version"

// replace it with the last text "1.0"

0x31, 0x2e, 0x30, 0x0 // @33 "1.0"

// the array would be so

TEXT_LOCATION_FLASH_PRAGMA
KEEP extern const touchgfx::Unicode::UnicodeChar texts_all_languages[] TEXT_LOCATION_FLASH_ATTRIBUTE = {
    0x42, 0x6f, 0x6f, 0x74, 0x6c, 0x6f, 0x61, 0x64, 0x65, 0x72, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x0, // @0 "Bootloader version"
    0x31, 0x2e, 0x30, 0x0, // @19 "Version"
    0x31, 0x2e, 0x32, 0x2e, 0x32, 0x0, // @27 "1.2.2"   // @27 became here wrong !!!
    0x31, 0x2e, 0x30, 0x0 // @33 "1.0"      // @33 became here wrong !!!
};

 

 

- The second is how this text will be applied in relation to the other languages? The difficult part is that touchgfx stores all texts for all languages in one array, but why? and it seems impossible to do such a thing in this case.

 

2- Colours: the challange is how to (select all) the texts and change the colour of them?

I have an idea which is to sort the texts into 3 groups as shown in the picture of the tool... because the only way to change the text colour is to change the colour of the text object itself and its not possible to change the colour of the whole resource or anything else thatswhy i think on creating a 3 arrays and each array represent a group of texts.

 

// The example may contain errors, only for explanation !

char ButtonColours[]={"textArea1", "textArea2", "textArea3"... };
char LablesColours[]={"textArea5", "textArea7", "textArea9"... };
char VariablesColours[]={"textArea12", "textArea20", "textArea22"... };

uint16_t ButtonColorRGB = unicode::touchgfx.getRGB(R, G, B);
uint16_t LablesColorRGB = unicode::touchgfx.getRGB(R, G, B);
uint16_t VariablesColorRGB = unicode::touchgfx.getRGB(R, G, B);

ButtonColours.setColor(ButtonColorRGB);
LablesColours.setColor(LablesColorRGB);
VariablesColours.setColor(VariablesColorRGB);

 

This way I think I could change the colour of the whole array, therefore all the text would change colour. What do you think? maybe there are code errors so please ignore that, i just wanted to explain my idea.

I know it is a big challenge and there are many ideas, but it should be possible to implement it somehow. I would be happy to hear your suggestions 🙂

Best regards,

Mahdi

1 ACCEPTED SOLUTION

Accepted Solutions
mids400
Associate III

I solved the problems and it was fully implemented.

View solution in original post

3 REPLIES 3
mids400
Associate III

Up..

mids400
Associate III

up..

mids400
Associate III

I solved the problems and it was fully implemented.