cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to overlay things created by C++ code, i.e. Circular Progress Bar, with things from graphical editor?

Electron Hunter
Associate II

Hello,

working with TGFX 4.10. I use the circular progress bar from git, respectively from one of the examples and so far I'm happy with it although it's a bit strange not to have it in graphical editor...

Now I need to overlay it with additional buttons for - | + , see attached picture:0690X00000AreuKQAR.pngIs there a chance to do the buttons in the graphical editor and put them to top layer so they are visible and clickable?

If not: Is there a good eaxample how to create buttons in C++ ?

Thanks in advance and best regards

Stefan

6 REPLIES 6
Martin KJELDSEN
Chief III

There is. What you can do through the designer is create a "Custom container". This will give you a generated file with the gui elements that you define on your canvas in the designer, and then you'll have a user class that inherits from this in which you can write your own gui code/logic.

Let me know how you do!

/Martin

Electron Hunter
Associate II

Hi Martin,

thanks for the answer!

Created CustomContainer and added it to C++ of CircularProgress Bar. Graphics are OK so far, I also could include Callback from Buttons and the Wildcard value.

Now the questions (which might also be lack of C++ knowledge on my side):

When I try to load or store values from the model I get compilation error, that "presenter" was not declared in this scope: Which file(s) do I need to include?

What is the proper way to get interaction with the circular progress bar? update the bar when +/- is clicked and vice versa update the Wildcard when bar is dragged...

Thanks in advance

Stefan

Martin KJELDSEN
Chief III

You do not have access to the presenter from a custom container, only from the view. What you could do is pass a view pointer to the custom container and access the model through this, or - implement a callback which would be more generic and allow you to use the container on several views, but maybe that's not necessary.

I'm not really sure what you want to do with the circular progress, but i'd say yes to both: allow the user to drag and touch as well as press + and -

/Martin

Electron Hunter
Associate II

Thanks for clarifying the the issue with presenter

Missunderstanding: It's not about user experience - he will be able to drag the bar as well as click +/- and change the same value, that's the goal of this instrument.

Question was about my coding experience - passing values from "view" over "circularprogress" to "container" and back as well as updating the circular bar when clicking the buttons. Do you have a suggestion for this?

Thanks in advance

Stefan

Martin KJELDSEN
Chief III

Ah, sorry for the misunderstanding!

I think this is related to user experience, still. What you could do is either set the values directly based on touchinput and then ALSO send the values to the backend. Then, what happens if storing / applying those values fails? That's something for you to consider.

Or, you could pass the values back directly and then only if they were applies with success, send them back to the view / custom container for the user to see. Would there be any delay in getting this feedback? I don't know :) Something for you to consider.

/Martin

sandaruwan
Associate II

Hi Stefan, can you share the git repo that you use?