cancel
Showing results for 
Search instead for 
Did you mean: 

How to call a same ModelWindow in different pages by press a hardware button.

xchen.1480
Associate II

My system have tens of pages, and have 3 hardware buttons to change the LCD backlight.

When change the backlight, it is needed to display a small window on the current page.

After finished the changing, the small window closed.

I know I can create ModelWindow in each page, and display it in handleKeyEvent.

In this case, I need to create the same code for each page. It must be very hard.

Is there any simple method to do it?

Thanks!

1 ACCEPTED SOLUTION
13 REPLIES 13
Martin KJELDSEN
Chief III

There is a way of doing this by having a "base view" for a group of screens - I'm so behind on this, i promised i would do an example for the community. It's a bit more difficult with the designer because all views already have a base-class (generated by designer).

So what this would enable you to do is from a view that are a part of this group will simply have access to a presenter method to show some dialogue or adjust the backlight.

/Martin

Thank you.

I'll wait for your example, and do the other works in my project at the same time.

I hope to receive your reply again when you finish it.

Hello, did you complete the example for the using in my this question?​

Nope, not yet, sorry. Swamped right now. But you could take a look yourself. I'll give you a few hints:

Designer generates base views and presenters (inside generated/gui_generated/). It also generates classes (inside gui/) which inherits from the base classes. What you need to do is not only inherit from the Base classes generated by the designer but also from some common class that defines common functionality for some "group" of screens. For both View and Presenter. I haven't tried it yet using the designer, but i'm pretty sure it's doable.

/Martin

Hello, for this question, I did it follow your suggestion in 2 methods (new base class I named it MyClass):

1, ​I defined MyClass as a page, like the xxxBaseView generated by designer. There are some error when build the project. I think it is because that MyClass and xxxBaseView are both create a page, it is not allowed in touchGFX.

2, I just defined MyClass as a method collection. But these method can not access any widget in xxxView.

I have not finished my requirement until now... :loudly_crying_face:

Can you give some more detailed suggestion? I am not good at C++, and don't understand the touchGFX framework very much.

Hi @xchen.1480​,

In these Corona virus times we're all working from home, so i think i can find some time to create an example now, despite still being super busy, at least there's just me at "the office".

/Martihn

Okay, i've completed an example in code - This is a general feature that is lacking from the designer, so the solution i'm constructing now is a bit convoluted and involves (later today) running a script that modifies your generated files (since these will get overwritten when re-generating from the designer).

I also want the example to utilize other general "best practices" so that it can become a more complete example of structuring application development.

So, i still have a bit of coding to do, and then i'll do a write up in a post.

/Martin

Thank you very much...

I think if TouchGFX can support multi-layer or global modal window​, my this requirement will be not a problem more.

And I know this will be a big update to do this.