I want to have a window:
. with close/minimize/fullscreen buttons
. with no title
. with title bar transparent
. and movable
I cant figure out how to make it movable.
This is working but not movable:
Self.NSWindowMBS.titleVisibility = NSWindowMBS.NSWindowTitleHidden
Self.NSWindowMBS.titlebarAppearsTransparent = True
Self.NSWindowMBS.Movable = True
Self.NSWindowMBS.styleMask = Me.NSWindowMBS.styleMask + NSWindowMBS.NSFullSizeContentViewWindowMask
Adding this doesnt solve the problem:
Self.NSWindowMBS.isMovableByWindowBackground = True
Does someone know how to make this window also movable ?
is there a movableByBackground setting ?
maybe set that one as well
I had success setting fewer properties. I only set
self.NSWindowMBS.styleMask = self.NSWindowMBS.styleMask + NSWindowMBS.NSFullSizeContentViewWindowMask
self.NSWindowMBS.titlebarAppearsTransparent = true
self.NSWindowMBS.isMovableByWindowBackground = true
Edit: I think it might be important that the Xojo window type is Document.
In my Window
Open event, I put the following:
Me.NSWindowMBS.styleMask = Me.NSWindowMBS.styleMask + NSWindowMBS.NSFullSizeContentViewWindowMask
Me.NSWindowMBS.titleVisibility = NSWindowMBS.NSWindowTitleHidden
Me.NSWindowMBS.titlebarAppearsTransparent = True
With the above, I still have the horizontal space usually occupied by the Title and Close/Min/Max buttons as the movable area to grab, as opposed to the whole window (which I find problematic).
@Tim Parnell & @Scott Cadillac thanks ! None of this works with my window, but knowing that it works for you I diged deeper.
The top of my window (document) is completely covered with a HTMLViewer which background is visible by transparency behind the title bar.
When the HTMLViewer is visible the window is not movable, when hidden the window is movable.
I solved it by placing a Label, covering the whole window, in front of everything (transparent, no text), the window becomes movable by grabbing the title bar area.
I guess it comes from HTMLViewers mouse events handling interfering with the move events.
However, as Scott said, moving from the whole window does not work.
Id prefer being able to move from the whole window but, I can live without it.
First time I hear you say that
Maybe you have an idea about the NSWindowMBS.isMovableByWindowBackground issue ?
Anyway, thanks everyone !
Im using Xojo 2019r3.1, macOS 10.15.4 (Catalina)
[quote=492690:@Olivier Colard]First time I hear you say that
Maybe you have an idea about the NSWindowMBS.isMovableByWindowBackground issue ?[/quote]
This has to do with
HTMLViewer not being the window background. Similarly, you aren’t able to drag this window around by a
PushButton or other control.
@Tim Parnell It make sense, thanks for clarifying.
I dont mind grabbing the title bar area, but as there is no title bar visible it could be disorienting for some users.
Overlay the HTML Viewer with a canvas, that’s the same height as the titlebar and use [NSWindow performDragWithEvent:] to start the drag on mouseDown.
@Christian Schmitz is this available? I have another window I’d love to take advantage of this with.
You can see an example of this exact thing code in use over a HTMLViewer here https://www.ohanaware.com/appreport/ it’s just a beta, so please be nice.
I wish this trick worked on Windows
There might be similar API for Windows, just I don’t know it, sorry.
- (void)performWindowDragWithEvent:(NSEvent *)event API_AVAILABLE(macos(10.11));
I can just add it to the NSWIndowMBS class in a minute…