Components, Child Components, disable Parent


I'm facing a situation that i cannot solve.

I have one Parent component that occupies the full screen application, in this Parent i have one button that makes visible another component that does not occupie the full screen, only a center part of the screen.

I need to disable all functions (buttons, text edits, etc) on Parent while child component is active.

Once I close the Child, i want the parent to be shown and with all functions active.

How can i do this ?

I know that i can use the way to make it modal (the child component) using Component::enterModalState().

But i want that if i click outside the child component, that this child component closes.

Can anyone help me ?


Have a look at Component::inputAttemptWhenModal()

Thanks Jules.

This solves one part, clicking outside, perfect.

But how can i solve the situation that is i do not use the clicking outside component, but all my buttons on parent are still active ?

In a way that only when i close the child component, this buttons will become active again ?

I tried to make all button not active using Button->setActive(false) and then call the child component, but if i close child and want to make buttons again active, it crashes.



Component::setEnabled() ?

Does not solve, since it makes child to be disabled also.

Well yes - but you could use it to disable just the buttons that you want to disable.

Or just stick a big transparent component over the whole thing to block mouse access. There are many things you could do, it just depends on what works for your app.