Mac Desktop app in Dock: a question

  1. 2 months ago

    Ralph A

    Aug 11 Santa Monica, California

    Until now, just been using Xojo to develop a Web app. Now I'm working on a Desktop app on the Mac. I notice that when the built app's last window is closed, its icon still appears in the System Tray as expected. But when I click on that System Tray icon, its window fails to appear. I'm used to Mac apps reappearing when click on their icon after having closed their window previously.

    When I think about it, it seems that Mac apps essentially get minimized when their window is closed (unlike Windows apps, which Quit when their window is closed). Is that what I have to code to make this app work like that?

    App.newdocument is what you're looking for.

  2. Ralph A

    Aug 11 Santa Monica, California

    For now, it seems that the most unconfusing way to handle this is to put AutoQuit=True in the App.Open event. That way the user isn't confused by the existence of the System Tray icon that fails to bring back the window the recently closed.

  3. Beatrix W

    Aug 11 Pre-Release Testers Europe (Germany)
    Edited 2 months ago by Beatrix W

    Calling the Dock "System Tray" is not a good idea.

    And no, Mac apps don't get minimized when their windows are closed. You can make apps "sticky" in the Dock by selecting "Stay in Dock" from the options menu. This doesn't happen automatically. When doing Skype sessions with customers I have seen screens with dozens of apps in the Dock.

    Then there is the whole mess of app nap when the OS decides on it's own when to quit the app or not. You can disable this.

    MacOS can restore open documents after restarting. I'm not sure if Xojo can do this.

    Some apps do AutoQuit. Most don't.

    I would recommend getting a bit more experience on Macs/MacOS.

  4. Ralph A

    Aug 11 Santa Monica, California

    Yes. I was confused describing what I'm used to seeing on the Mac. Let's take Chrome. On the Mac, when I close Chrome, it remains running without an open window. When I click on its icon in the Dock (sorry for calling it System Tray), it loads a window again.

    And when I create a Xojo Desktop app, and run it, and close its single window, it keeps running and remains in the Dock, just like Chrome. But when I then click on its Dock icon, no window appears. Is there a way to code this app so that clicking on its Dock icon while still running, loads its window?

  5. Beatrix W

    Aug 11 Pre-Release Testers Europe (Germany)

    You could try to use App.activate to show a new window if none is visible. Like Xojo does with the launcher window.

  6. Sam R

    Aug 11 Pre-Release Testers, Xojo Pro Answer Hengchun, Pingtung, Taiwan

    App.newdocument is what you're looking for.

  7. @Ralph A Let's take Chrome. On the Mac, when I close Chrome, it remains running without an open window.

    On the Mac, closing a window doesn't automatically quit the app(lication).

    @Ralph Alvy When I click on its icon in the Dock (sorry for calling it System Tray), it loads a window again.

    Probably like written above. Even the Finder Dock icon opens a new window if it has been clicked.

  8. Emile S

    Aug 12 Europe (France, Strasbourg)

    When you have an application icon on the Dock, what happens when you press the Command-Tab keys ?

  9. Ralph A

    Aug 12 Santa Monica, California

    @Sam R App.newdocument is what you're looking for.

    Yep. That does it. Thanks, Sam.

    App.NewDocument (event)
    Window1.Show

  10. Ralph A

    Aug 12 Santa Monica, California

    @Emile S When you have an application icon on the Dock, what happens when you press the Command-Tab keys ?

    The window is not revived, though the app becomes active again. The App.NewDocument event solved this for me.

  11. Emile S

    Aug 13 Europe (France, Strasbourg)

    @Ralph A The window is not revived

    You closed it. So, you have to open it gain.

or Sign Up to reply!