New window on active virtual desktop

I have recently downloaded Xojo and have been getting to grips with the language and it’s quirks.

I am currently trying to see if it is possible to create a notification that pops up whenever a contact comes online (similar to msn messenger/skype etc). Ive coded this and it all works fine however I can’t seem to find a setting that allows a new window to appear on the active virtual desktop.

Out of all the available window types “global floating” seems the most appropriate as it should in theory appear on top for a few seconds then disappear. However that setting only appears to work on the virtual desktop that the main app/window is running on. I have searched the forum and the only topic about virtual desktop appears to be back from when Windows 10 was first available in preview form. So I’m hoping some progress has been made on it since then?

Out of all the available window types, only “metal” appears to work on the virtual desktop you currently have active. However there seems to be no way to make the window appear on top of other windows. I have searched the forum and found a declare that is supposed to make the window appear on top - but in practice it seems to have no effect (or at least no effect on my setup).

Primarily I’m developing and testing on Windows. But if there is a solution that works on Mac also, then that would be appreciated as I may port to Mac in the future.

Or… am I going about this in completely the wrong way? Is there a way to trigger the native notification system via Xojo (my forum searches seemed to indicate the general consensus was no).

Thank you in advance for any help.

Welcome to Xojo. I’m a Mac and don’t know much about Windows.

a) Buy the MBS plugin. If you have lots of time then you can figure the stuff out yourself. Otherwise, buy the plugin because it can do everything. From the MBS plugin you can use NSUserNotificationMBS ( .

b) You can use AppleScript ( Which is a nasty hassle to use with Mojave and Catalina.

Thank you for the reply and sorry for the delay in getting back to you.

I have discovered a way of achieving what I was after on Windows (haven’t tested on Mac yet). It’s very hacky and I get the impression that it may not work on all systems. But for anyone else who is looking for a solution to this, it might be a starting point for a more elegant solution.

I have found if you open a window with the setting of “Metal Window”, it will open on the virtual desktop you are currently active on. If you then open the real notification window (with the setting of “Global Floating Window”) via code that lives under the metal window, the notification will then correctly show on the current screen and on top of others. It’s then just a case of hiding the original metal window and making sure it’s closed when the notification disappears.

I highly doubt this is intended behaviour… but it works and seems to be the only way I can find to display a notification with Xojo without the need for additional software.

In windows, any window that doesn’t have a parent will display on the current virtual desktop when its shown, if it has a parent it will move the virtual desktop view to that desktop.

To check through the various window types in xojo put this code in your Windows Open/Opening event and it’ll tell you if it has a parent or not as there’s no property on the window to indicate otherwise.

Declare Function GetParent Lib "User32.dll" Alias "GetParent" (hWnd As Integer) As Integer If GetParent(Self.handle) > 0 Then MsgBox("HasParent")

You can then use this knowledge to pick your best window type for your requirements :slight_smile: