2019-01-14 05:56 AM
Hello
I have a custom container common to several screen (with OK button in it).
How can i call a callback of the current screen when a button is pressed in the container ?
I do call the callback of the custom containe, but don't know how to propagate it to the current view.
(for example when OK button is pressed i want to execute the action in each view containing this custom container)
I there an example of this ?
thanks
regards
Solved! Go to Solution.
2019-02-05 01:52 AM
Here it is. A project that defines a screen with two custom containers (Both CustomContainer1). CustomContainer1 has a background and a ClickListener Box. When the Box is pressed, the CustomContainer catches this in an internal handler and then calls a Callback (set by the view) to communicate it's identity back. Based on this identity (The first or the second custom container) it will show/hide the custom containers.
I've written some comments in the code - Let me know if you need more information.
2019-01-15 12:35 AM
Hi @Professional,
Just to let you know i've seen your question. I'm traveling right now, but i I will create an example that shows you how to do this.
Best regards,
Martin
2019-01-15 12:42 AM
Thanks a lot for your support !!!
2019-01-15 11:36 PM
Hello,
do you know when you will be able to create this example ?
thanks
2019-01-21 01:13 AM
Hello
do you know when the example will be available ?
Thanks
2019-02-05 01:52 AM
Here it is. A project that defines a screen with two custom containers (Both CustomContainer1). CustomContainer1 has a background and a ClickListener Box. When the Box is pressed, the CustomContainer catches this in an internal handler and then calls a Callback (set by the view) to communicate it's identity back. Based on this identity (The first or the second custom container) it will show/hide the custom containers.
I've written some comments in the code - Let me know if you need more information.
2019-02-05 02:13 AM
Hello thank you for your example;it doesn't compile in visual studio but I will try to make it work in my project !
best regards
2019-02-05 02:50 AM
I used Visual Studio 2017, so it does work, but you may need to retarget to whatever version you're using.
2019-02-05 03:56 AM
You can also simply "Run Simulator" from within the designer to compile using gcc. Both should work.
2019-07-18 09:32 AM
Hey. I'm trying, as an example, to use CallBack with the CustomContainer. But I do not use Box, I use FlexButton with include TextArea.
From the Widget Box, the declaration looks like:
touchgfx::ClickListener< touchgfx::Box > box2;
So that the function call looks like:
box2.setClickAction(boxClickedCallback);
When used with FlexButton, the declaration looks like:
touchgfx::ClickListener< touchgfx::TextButtonStyle< touchgfx::BoxWithBorderButtonStyle< touchgfx::ClickButtonTrigger > > > btn0;
And now when:
btn0.setClickAction(boxClickedCallback);
I am getting an error when compiling:
no matching function for call to 'touchgfx :: ClickListener <touchgfx :: TextButtonStyle <touchgfx :: BoxWithBorderButtonStyle <touchgfx :: ClickButtonTrigger>>> :: setClickAction (touchgfx :: Callback <NumPad, const touchgfx :: ClickButtonTrigger &, const touchgfx :: ClickEvent &> &) '