cancel
Showing results for 
Search instead for 
Did you mean: 

Can ModalWindow hijack hardware button handling?

Tuoman
Senior II

I figured that ModalWindow can hijack touch buttons easily, but how can I do this for hardware buttons?

Is the only way to only call custom functions? So that in Designer I always use Interaction to call virtual function1, and route it like this:

function1(){
if (modalwindow1.isvisible())
{
... modal window handling
} else {
 
...normal application button handling, change Screen etc.
}
}

This way I cannot use any of the default Interactions (change Screen etc.) in Designer, because they would act the same regardless of modal window is shown. So I have to route every screen change via virtual function call.

Would be nice if the modal window could override the handleKeyEvent()

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Martin KJELDSEN
Chief III

There's nothing inherent in the functionality of the ModalWindow class that can do anything with hardware buttons.

There's a way to connect hardware buttons to interactions - would that do it for you?

/Martin

View solution in original post

3 REPLIES 3
Martin KJELDSEN
Chief III

There's nothing inherent in the functionality of the ModalWindow class that can do anything with hardware buttons.

There's a way to connect hardware buttons to interactions - would that do it for you?

/Martin

>There's nothing inherent in the functionality of the ModalWindow class that can do anything with hardware buttons.

Ok. I think this would be as useful as hijacking touch events. Just like the ModalWindow does with touch events:

@class   ModalWindow ModalWindow.hpp include/gui/common/ModalWindow.hpp
@brief   Container for displaying a modal window and hijacking touch event to underlaying viewand widgets.

(we don't have touchscreen in our product, only hardware buttons)

>There's a way to connect hardware buttons to interactions - would that do it for you?

Is this the system I proposed? E.g. map everything to virtual functions, which will check for the modal. Ok, I will use that. I should work, just needs a lot of repeated code, and I cannot use "change screen" in designer (because it will change screen regardless of modal window).

What "hijacking touch events" means is simply that it's an overlay, and as such, things that are below it won't receive touch events. The description is a bit convoluted.

/Martin