Window that remains visible always

Hello,

Is it possible to have a window frontmost even when a different app is in use?

If so, how can I do that?

Thanks.

Lennox

See Window.Type to pick global floating window:
http://documentation.xojo.com/api/deprecated/window.html#window-types

Thanks Christian,

Tried that but when another app is launched or brought frontmost that window goes into the background is no longer visible.

What I am trying to achieve is like holding a piece of cardboard in front of the screen so that part of the screen is hidden.

Lennox

@Lennox_Jacob This is from the documentation

Global Floating Window

A Global Floating window looks like a Floating window, except that it is able to appear in front of another app’s windows, even when you bring another app window to the front. A “regular” Floating window appears only in front of its own app’s windows.

(Emphasis in mine)

Did you pick Floating Window or Global Floating Windows ?

1 Like

I selected “Global Floating Window”

When another app is launched or brought frontmost that window goes into the background and is no longer visible.

Using XOJO Version 2019 Release 1 and macOS Catalina 10.15.7 (19H2)
on Model Name: Mac mini
Model Identifier: Macmini7,1
Processor Name: Dual-Core Intel Core i7
Processor Speed: 3 GHz
Number of Processors: 1
Total Number of Cores: 2
L2 Cache (per Core): 256 KB
L3 Cache: 4 MB
Hyper-Threading Technology: Enabled
Memory: 16 GB
Boot ROM Version: 426.0.0.0.0
SMC Version (system): 2.24f32

Lennox

Maybe you like to check our OverlayMBS class in the MBS Plugins?

Does this help?

Window1.Open
#if TargetCocoa
  declare sub NSWindowSetHidesOnDeactivate lib "AppKit" selector "setHidesOnDeactivate:" (obj as integer, value as boolean)
  NSWindowSetHidesOnDeactivate(self.Handle,False)
#endif

Thanks Mike D,

Works perfectly, just what I wanted.
Thanks again.

Ennox

ON 10.14, if you are using a “Floating Window” style, you need this hack, but if you are using “Global Floating Window” then you shouldn’t need it. As @Gilles_Plante asks, which kind are you using?

Note: there are some other behavioral differences between FW and GFW, so it may make sense to use FW + setHidesOnDeactivate rather than GFW. The differences have to do with issues such as “what does clicking on the window do” (does it activate the App or not?) and other issues with window focus.

Hi Mike,

I am using GFW and it works well with the code you provided. I did not bother to try FW since it is already working great but I will bear your comments in mind.

Clicking on the window, whether it is the active window or not, does not seem to matter, and it does not activate the App.

Thanks again.

Lennox