cancel
Showing results for 
Search instead for 
Did you mean: 

Adding elements to list

heyo
Senior

I'm faced with problem when I add elements to list. For better understanding I explain what I want to do. So here when I click add new elements I go to other screen where config pinout. And when I click save it stores names like "VM1", "Main module" in array there is placed in model.hpp. In list layout I can create 5 elements.0693W00000Y96nNQAR.pngWhen I add more than 3 elements to the list my names somehow which I store in array disappear and random values which is in my project enrolls

0693W00000Y96qRQAR.pngWhat can cause this problem?

8 REPLIES 8
Yoann KLEIN
ST Employee

Hello @heyo​,

That looks like an out-of-bound issue.

How did you create and initialize your array ?

/Yoann

Yoann KLEIN
ST Software Developer | TouchGFX

I create structure in model.hpp

0693W00000Y97haQAB.pngThis is how put information in to arrays

0693W00000Y97hfQAB.png

Can you also show me how you display your Array values into the screen ?

Also, why are you using 2-dimensionnal arrays for Headlines and Correction ?

/Yoann

Yoann KLEIN
ST Software Developer | TouchGFX

@Yoann 2-dimensionnal arrays because in one row writes more than one symbol. I mean if I want to write "176" number I need three positions if I correctly understand.

AirTemperature_Save is how many times was pressed save I mean how many elements are in list. From the model.hpp I take data

0693W00000Y97tbQAB.pngHere adding elements to list :

0693W00000Y97tqQAB.pngAnd this is how create list members:

0693W00000Y97uKQAR.png

That's gonna be hard to debug without having access to your project, can you share it ?

/Yoann

Yoann KLEIN
ST Software Developer | TouchGFX

PM

Hi,

May I ask what is this line supposed to do ?

memset ( & Cfg_C7_temperature.Headline[idx][30] , 0, 30 );

If intention is to clear the string at index 'idx' then this is correct statement

memset ( Cfg_C7_temperature.Headline[idx] , 0, sizeof (Unicode::UnicodeChar)*30 );

Nope, this is not working for me as you said.