Drawing over the Window Title Area

I am needing to do this is Swift, but would assume an Xojo solution would include a declare which I could then adapt.

It is possible to make the Title transparent, so it shows the selected background color, but I need to draw OVER it as well

in this example… I would want the WHITE to extend to the top of the window (it is a fill rect in the windows draw method (ie. Paint)

Note : setting it to BORDERLESS, removes the traffic light, and there is “no border”… which is also required otherwise the window gets “lost” on the screen

I think we have an example for that coming with MBS Plugins…
Email me if you are interested.

So MBS won’t do me any good

Being able to do in in Xojo might give you a hint as to how to do it in swift
Maybe ?

yes it might… but not a MBS method… a valid DECLARE perhaps

But so far my research hasn’t shown any evidence that it is possible…

my current solution is to set it to “resizeable” which removes the title (and traffic light) but retains the visual border. I then put a fake NSButton in place of the Red ball

and I end up with this, which is "acceptable

NSWindowSetStyleMask( me.handle ) = NSWindowStyleMask( me.handle ) + NSWindowStyleMaskFullSizeContentView

1 Like

Thanks Sam… that was almost right :slight_smile:

NSWindowSetStyleMask( me.handle ) = NSWindowStyleMaskFullSizeContentView

otherwise any previous attributes remain, and if .Titled is set (which it usually is) all the traffic lights appear… You can set the title to and self.titlebarAppearsTransparent = true, but you seem to lose control of the traffic lights

Note : adding or deleting the flags for the traffic lights has no effect if both FullSizeContent and Titled are on (I’ve tried all the combinations)

if you remove .Titles you lose the traffic light completely… so I still need my “fake” button

Turns out this is NOT the whole solution :frowning:
While using this flag allowed me to make the window look like I wanted, that particular mask disabled any controls on the window.

if .TITLED isn’t in the mask nothing seems to work… which begs the question… WHY?

make the mask [.titled,.fullsizecontentview]
self.titlebarAppearsTransparent = true
        self.closeButton =  false
        self.maximizeButton = false
        self.minimizeButton = false


so you have to have them but they dont have to be visible and that solves the “why are things disabled?” issue ?
that seems VERY weird and wrong

it just adds to the WTF it seems…

But yeah… the mask MUST contain .TITLE (I tried every possible combo, and if TITLE wasn’t there… nothing worked (well Textfields)…

So I added the Mask, then made the titlearea transparent, removed any caption, and disabled the individual traffic lights. I wanted just the red one, but if I leave that “on”, and the others off, I get RED and 2 gray… so I left my fake one.

If anyone comes up with a scenario the provides the desired results and is more “proper”… I’m open to it :smiley:

1 Like

This is what I do in a window, where I only want the close box to appear and without showing the title-bar (although I still want the window title visible).

NSButtonHidden( NSWindowStandardWindowButton( me.handle, NSWIndowButton.miniaturize ) ) = true
NSButtonHidden( NSWindowStandardWindowButton( me.handle, NSWindowButton.zoom ) ) = true

NSWindowStyleMask( me.handle ) = NSWindowStyleMask( me.handle ) + NSWindowStyleMaskFullSizeContentView
NSWindowTitlebarAppearsTransparent( me.handle ) = true

NSWindowAnimationBehavior( me.handle ) = NSWindowAnimation.alertPanel

If you found the example project coming with the plugin, you may notice that it just gets the parent view of the content view to add a control there.
You can do that in Swift. Just NSView

No offense Christian… but no I did not need to attempt to analyze your plugin… .but thank you… And as noted above… I have solved the situation

1 Like