Transparent title bar with latest Xojo

Hello, I’m trying to implement a modern window with a transparent title for macOS Ventura but all the code I found is not working with latest version of Xojo.

My app is only working from macOS 11. What is the best declare for it?

1 Like

found this code working but lost the ability to move the window.

If TargetmacOS Then
  declare sub setStyleMask lib  "Cocoa" selector "setStyleMask:" (w as integer, s As integer)
  declare function styleMask lib "Cocoa" selector "styleMask" (w as integer) As integer
  
  //Yosemite only
  declare sub setTitlebarAppearsTransparent lib "Cocoa" selector "setTitlebarAppearsTransparent:" (windowHandle as integer, value as boolean)
  setTitlebarAppearsTransparent(Integer(self.Handle), true)
  
  //add NSFullSizeContentViewWindowMask
  setStyleMask(Integer(self.Handle), styleMask(Integer(self.Handle)) or 32768)
  
  const NSWindowTitleHidden = 1
  declare sub setTitleVisibility lib "Cocoa" selector "setTitleVisibility:" (windowHandle as Integer, value as Integer)
  setTitleVisibility(Integer(self.Handle),NSWindowTitleHidden)
End if

To give more details, I was able to drag the window by adding this code

declare sub setMovableByWindowBackground lib "Cocoa" selector "setMovableByWindowBackground:" (windowRef as integer, yesNo as integer)
setMovableByWindowBackground(integer(self.handle), 1)

but when the DesktopHTMLViewer covers the title bar, it’s not working when you click on the web content.

@Christian_Schmitz
Seems that a solution is described here but I don’t understand the code to put in MouseDown event

i replaced all code above with this code:


Self.NSWindowMBS.isMovableByWindowBackground = True

Var Win As NSWindowMBS = Self.NSWindowMBS
Win.StyleMask = Win.StyleMask Or NSWindowMBS.NSFullSizeContentViewWindowMask
Win.TitlebarAppearsTransparent = True
Win.TitleVisibility = NSWindowMBS.NSWindowTitleHidden

Now, i want to able able to move the window when there is a HtmlView under the title bar.