cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass index or text from custom container which is in another container to view window? I need example.

heyo
Senior
 
8 REPLIES 8
JTP1
Lead

Hello

Perhaps you could use Custom triggers to generate callback first from custom container to parent container and then another custom trigger to generate callback from parent container to view- class.

In this example use of custom triggers is demostrated (from sub container to parent container):

https://community.st.com/s/contentdocument/0693W00000aHeqeQAC

Thanks for reply. In that example it does not clear how TOUCHGFX generates callbacks:


_legacyfs_online_stmicro_images_0693W00000biNPyQAM.png
_legacyfs_online_stmicro_images_0693W00000biNQ3QAM.png

Okay, I found that here is created custom trigger:


_legacyfs_online_stmicro_images_0693W00000biNRBQA2.pngBut how that text is passed to other container does not find

JTP1
Lead

You could use trigger system to send notification to the wiew- class, that text can be retrieved and then use simply functions from view class to container and finally to sub container. Check the example, in keypad.cpp there is char* Keypad::getText() function and in the KeypadCustomWidgetExample.cpp file is call for that.

Otherway is to create Trigger and set type char * or const char * (depending what you are sending)


_legacyfs_online_stmicro_images_0693W00000biQRxQAM.pngPlease also note that you can use TGFX Designer Interactions to create handler for these trigger callbacks and then call some virtual function in the container:
_legacyfs_online_stmicro_images_0693W00000biQTKQA2.pngAnd then define the virtual function and handle the text or trigger another callback to send it to the wiew- class.

But to be honest... sending strings thru the containers sounds bit weird  I wonder what you are trying achieve with this.

I need pass just a variable from container to view. In custom container I have button and I need to pass how many times button was pressed. Problem is this that I create in view screen list layout and in that list putting custom container


_legacyfs_online_stmicro_images_0693W00000biQYZQA2.pngCustom container:

0693W00000biQYeQAM_image.png

And in this container u can see plus button which I need to know how many times it was pressed because I need to know that value to create other list element.. I do not know are u understand :D Maybe u have other solution?

JTP1
Lead

Not completely understand, it is difficult when not see the hole picture how you have organize the things in UI.

But you could send trigger callback everytime when plus is pressed, or simply keep the count of presses in the container local variable and then read the counter value from parent class with simple function when adding things is finished ?

It's difficult to explain :D amm, that container is not included in my view window and I can't access it. If I add custom container in my view it would be easy but now I've created list layout and in that list is custom container .

Like this:

0693W00000biQzkQAE_image.png

I can send more code if it helps to understand what I want :D

Osman SOYKURT
ST Employee

Hello heyo,

Did you find a solution to your problem? If not, I was thinking maybe you can store your value from your container in the model and then get that value in your view screen.

/Osman

Osman SOYKURT
ST Software Developer | TouchGFX