MacOS Window Shadows

Hi Xojo’ers. I’m using…

Declare Sub hasShadow Lib “Cocoa” Selector “setHasShadow:” (id As Integer, b As Boolean)
hasShadow(Self.Handle, False)

…in the windows open event to remove the shadow - problem seems to be this also stops the window from drawing it’s border. Anyone know of a way to have the window draw its border and stop MacOS drawing the window shadow without having to revert to the windows paint event to manually draw it?

Regards,
Dave.

Have-you read this page:

https://developer.apple.com/documentation/appkit/nswindow

Hi Emile, yes. that’s where I found the setHasShadow bool. Which works, but as I mentioned, it seems to also remove the windows border! Or am I missing something obvious?!?! Cheers.

I think so, 4 entries below:

func contentBorderThickness(for: NSRectEdge) -> CGFloat

Indicates the thickness of a given border of the window.

``

You also have:
func invalidateShadow()

Invalidates the window shadow so that it is recomputed based on the current window shape.

Hi again Emile, setting contentBorderThickness and calling invalidateShadow doesn’t result in a border being drawn.

Sorry.

Do you know about macOSLib ?

https://codeload.github.com/macoslib/macoslib/zip/refs/heads/master

I downloaded it and am reading, so I do not know if it will be an answer, however it may be useful.

Apparently, macOSLib shows the behavior you’re complaining about:

The same question was asked in 2014 with the same answer, but noone complains about a lack of border.

paint event here we come then! Cheers.

Did you also

setAutorecalculatesContentBorderThickness:forEdge:

(maxX, MaxY) to True?