I’m seeing a bug (or is it by design?) where a movable modal isn’t modal unless called by the ShowModal method (then, code won’t continue unless I use a timer or other techniques to call the rest of the code).
In Xojo, there is the “frame” property (Movable modal/Modal dialog) and the method (ShowModal/ShowModalWithin), so four cases:
1: frame=movable modal, called with ShowModal: shows a modal window (visually) and prevents other windows to be brought to the front.
2: frame=movable modal, called with Show, but not ShowModal: shows a visually modal window but acts like a document window (can be put to the background).
3: frame≠movable modal, called with ShowModal: this only implies the code waits for the window to hide, be it any kind of window.
4: frame≠movable modal, called without ShowModal: normal cases for documents/floating windows.
Other than seeming like a mess because the same word is used twice for different meanings, none of these cases permit to show a modal window (i.e. preventing other apps to be brought to the front) while not stopping the code flow.
I would have expected case 2 to do that but the frame “modal” alone (without calling ShowModal) treats the window like a regular one. What’s the purpose of this frame type if it depends on how the window is shown?
I’m pretty sure the dialog isn’t properly modal unless you use ShowModal. From what I can remember ShowModal invokes a specific macOS API call that makes the dialog act correctly.
We solved the running code issue via a MBS function (think it was CallMethodLater).
A timer and a delegate would probably achieve the same result.
Thank you.
For the workarounds, I have the ideas (though it will require me to change my code), but I’m wondering why Xojo doesn’t invoke the same API with calling the regular “Show” method with a movable modal.
In other words, how is a window with a frame of “Modal dialog” actually modal if showing it with “show” doesn’t make it modal?
In soome cases you may need to have a non-modal instance. Modal can block things like sockets and shell incoming data events from being raised until the modal ends. FWIW, the progress sheet in ExeWrapper is non-modal for this reason.
I’ve never used sockets in a modal window as of yet, so I’m guessing. You’re talking about the ShowModal call of a window, right, not the modal frame?
Because, to me, those are different calls and the blocking you mention, I would think, is not related to the frame.
Thank you.