Sheet Windows in OSX

When I call to open a window as a sheet from the menubar the menubar stays highlighted in blue while the sheet is visible.

Is this a bug because Apple’s apps do not have this behaviour.

The IDE also behaves this way, select Page Setup… to see it in action.

All the best

Terry

I see the same. Solution: The menu starts a Timer on the window that shows the sheet window instead of showing it directly.

Thanks, I wonder why it’s not implemented in the IDE?

You can get the sheet attached to the wrong item

I understand your words but could you explain a little more?

Thanks

well say you have a process running that happens to switch windows or shows another
you could

  1. run the menu handler which starts the timer
  2. the other process switches front windows
  3. now your timer runs and the sheet is attached to the wrong window - not the one you intended

I know this from experience writing the IDE :stuck_out_tongue:

Thanks for expanding on this, quite clear now.

However, is this a bug or not?

No Apple apps I can find have this behaviour or is there another solution?

Thanks

What the timer does is let the event finish THEN opens the sheet window.
The event finishing unhilites the menu and so things look right.

Is this a “bug” … not given the way Xojo’s menu handling works , the fact that you can add code into the event to cause other code to run etc.

Apple handles this entirely differently and I’m not sure how / if we could do that in Xojo without driving everyone crazy.

It should be possible to verify which window is in front before displaying the sheet window, maybe with some declare.

I will investigate

thanks

Use ShowWithin() instead of ShowModalWithin().

Just realized that the user then can select other windows in the application. So ShowWithin() will only work when it is “window-modal”, but not when it should be “application-modal”.

Ideally if you want the window to be application modal, then you shouldn’t be using a sheet dialog, but a modal dialog instead.

Yeah, you should use ShowWithin instead of ShowModalWithin for sheets.