I’ve one “DialogWindow::showModalDialog” with a component which call “setMinimised (true)” to its parent (the DialogWindow) inside a “buttonClicked” . This goes ok, but when I call “setMinimised (false)” (still in the buttonClicked), the modal dialog ends (returning 0).
Thanks in advance.
Well yeah… How do you expect it to remain modal if it’s minimised??
I thought I could minimize the window to keep it hidden while showing another modal window (daughter of the minimized).
I’m confused by what you’re trying to do… If you’re calling setMinimised (false) after you’ve run the modal loop, then your dialog has already ended, right?
I’m calling a new modal dialog inside a component which belong to a modal dialog window, and before I call the new modal dialog window I need to put the actual modal window “minimized”. When the second modal returns, I put “minimized false” to show again the first modal (the actual), but this makes the this first modal to end (returning “0”). In pseudo code;
Make DialogWindow “first_modal” Modal with Component “first_component”
(Inside “first_component”, event ButtonClick)
Make “first_modal” Minimised (true)
Make DialogWindow “second_modal” Modal
(wait until end modal “second_modal”)
Make “first_modal” Minimised (false)
End event ButtonClick --> Ops! The “first_modal” return from Modal with “cancel” (but not pressed, nor canceled)
I hope it’s understandable …
If you don’t want the windows visible, why don’t you just hide them?
When I put “setVisible (false)” is the same.
Edit: After “setVisible (true)”, getNumCurrentlyModalComponents () == 0 it should be == 1.
Sorry, I just thought about this properly, and the behaviour is actually correct.
When you have a stack of modal components, each one can only remain modal while the previous one is still modal. If you cancel the modal state of a window (by hiding it), that’ll also cancel everything that’s above it in the stack. That’s not a bug, that’s the correct behaviour.
If you’ve got a window that you want to disappear while another one appears, then just show them one after the other! If you’ve hidden the first window, then you don’t need to make the next one modal to protect the first one from being changed!
The behavior of putting one modal over other modal window is common, but my case is more particular: the first modal window has more than one option. One of them requires another modal window, but first I need the first modal to be temporarily hidden in order to have better vision of the principal window.
I temporarily solved the problem putting 1 pixel window height (plus the dialog bar). It is not very elegant, but at least it keeps the application logic.
Another better solution…?
Thanks in advance!