How to create a blocker overlay?

so, I have my dialogs, with several inner elements: borders, buttons, listbox, etc…

now this parent dialog has a child modal dialog, and I need to create a blocker (same size and position of the parent) to prevent any clicks from activating things on the parent, also blocking all elements hovers over effects etc…

[details=Tricky temp workaround prone to break things]currently I tricked lemur on ignoring a blocker Button() by using jme’s attachChild() this way:
parent dialog ← jme simple Node() ← lemur huge transparent Button("") being used as a blocker (that will intercept mouse clicks/drags thru lemur and send them to the parent dialog as a whole like dragging the whole dialog or just focusing it)
(if I connect the Button() directly on the parent dialog it will not work, of course I guess, as it would mess the lemur’s layout)

this is just a temporary workaround that I needed for quick tests.[/details]

I wonder how to do it properly in lemur way, if it is possible at all?
A Control may be?

I imagine you’d like to block all background input and not just over the parent?

If so then you can use the new PopupState in Lemur 1.9.

If you call showModalPopup() with your child then it will be placed over an invisible blocker panel that covers the whole screen. (You can even color the blocker panel with a different method, say if you want the rest of the screen to darken while the child is open.)


Oohhh I want that I want that. I will upgrade asap :slight_smile:

Uhm no, in this specific case, I need to block the input only on each parent dialog, because I have other dialogs that can still receive input, but the ones that became parents with a modal child (and there can have many) each of them must be individually blocked (and still allow dragging and focus request (the focus request will be re-sent to it’s abovely opened modal child and that dialogs tree will be raised above others))

ugh! I just implemented that too!
I call it “system alert” so every input is piped thru a single place, so I can capture keybindings.
Everything else is blocked by a full window button and the input is all prevented to everything behind it!
I guess I should have updated b4 doing it so I could start from what you implemented, hehe… let me try it too, thx!
EDIT: btw, I guess you are looping on all childs on the GUI node (or whatever node we are using) to place it above, or just using an specific very high height? my dialogs are displaced z+=10f between each other, and I have been placing the hackish blocker in between each dialog z+=5f, as each 1f is like a stack of 100 lemur gui elements, I guess it is quite safe.

I ask the gui node for its bounding box and then place the panel above that with some small additional space.

1 Like

mmmm… cool!
that is better than my guessed Z for the hack blocker for the parents too, thx! :smiley: