Skip to main content
Tuoman
Senior II
February 28, 2020
Solved

Can ModalWindow hijack hardware button handling?

  • February 28, 2020
  • 3 replies
  • 937 views

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!

This topic has been closed for replies.
Best answer by Martin KJELDSEN

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

3 replies

Martin KJELDSEN
Martin KJELDSENBest answer
Principal III
February 28, 2020

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

Tuoman
TuomanAuthor
Senior II
February 28, 2020

>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).