2019-02-18 02:36 AM
Hello,
I am using a custom container which is used in most of the screens as TopBar showing various details.
The details are varied by using depending on the backend values of the system.
Normally, we use Model-Presenter-View for communicating with backend.
But how to control the widgets of custom container as there are no presenter/view for it.
Thanks,
Ameya
Solved! Go to Solution.
2019-02-18 03:34 AM
Hi @Ameya M,
Containers are drawables that are added to your screen through the add() method. If you're using custom containers and you've added one to your canvas for a screen this has already been done for you by the designer.
The designer also creates an inherited class for you (e.g. public MyCustomContainer : public CustomContainerBase) which you can find in the gui/ folder. You can enhance this class with the methods you need so that you can setup the custom container from your view in whatever way you want: setupScreen() to initialize it, etc.
Hope that clarifies things a bit.
Best regards,
Martin
2019-02-18 03:34 AM
Hi @Ameya M,
Containers are drawables that are added to your screen through the add() method. If you're using custom containers and you've added one to your canvas for a screen this has already been done for you by the designer.
The designer also creates an inherited class for you (e.g. public MyCustomContainer : public CustomContainerBase) which you can find in the gui/ folder. You can enhance this class with the methods you need so that you can setup the custom container from your view in whatever way you want: setupScreen() to initialize it, etc.
Hope that clarifies things a bit.
Best regards,
Martin
2019-02-18 05:39 AM
Hi Martin,
Thanks for replying.
I tried to do as per your example codes posted on other posts.
But the event I have is nothing, like button press in the other example.
Currently, the values of the container (I am using Wildcard text buffer), get updated only when I change the screen,
How can the values be updated when on the same screen.
Thanks,
Ameya
2019-02-18 01:20 PM
Hi @Ameya M,
Can you try telling me a bit more about what you're trying to do? It's not 100% clear to me if my first post did not help (It's a different approach from the example in the other posts). It seems like you're just interested in updating your custom containers with new values received from e.g. the model/other tasks.
And maybe also share your project with me. Thanks!
Best regards,
Martin
2019-02-18 01:26 PM
It may be helpful for you to check out the "Understanding MVP" UI template available when creating a new application through the designer.
If you enhance your custom container subclass (Generated for you by designer) with methods to set new values, you should have what you're looking for.
Check it out and let me know.
/Martin
2019-02-22 11:20 PM
Hi Martin,
I have multiple screens with same custom container, called TopBar.
In this container I have added a Wildcard Text Area, which changes values as per ADC reading from backend.
Earlier I was implementing it only on one screen so I directly used Model -> Presenter -> View method to change the values of Wildcard as per backend. It works perfectly.
Now I want to display the same Wildcard on multiple screens, so I added custom container TopBar.
In the generated subclass of the CustmContainer TopBar.cpp I read the values from backend from the view using extern variables and display the text as per.
The current issue is that even if the value is changed the text area is not updated when on the same screen, It gets updated when went to the other screen. The text displayed is correct but it is not responsive when on the same screen.
Even if the value is changed the text area has the same value until we go to other screen. But when we go to other screen, the value is correct but again unresponsive to changes when on same screen.
What could be missing/wrong in the code.
Thanks,
Ameya
2019-03-07 01:57 AM
Remember to invalidate your TextArea when updating the wild card buffer for that widget.