OverlayWindowMBS can no longer be used on 64bit macOS.
I used it to make a Window transparent, which has a picture on it, a progressbar and a label.
I see that I can use OverlayMBS now and somehow mimic the behaviour of controls by painting myself, but I have hoped to find a solution which works more like the old (now obsolete) solution: use a window, drop some controls on it, make the window transparent.
Are there declares to achieve this?
Like NSPopoverMBS?
[code]vcTask = new NSViewControllerMBS
vcTask.view = CCPrivacyShort.NSViewMBS
pvrTask = new NSPopoverMBS
pvrTask.animates = true
pvrTask.contentViewController = vcTask
pvrTask.behavior = pvrTask.NSPopoverBehaviorTransient
dim v as NSViewMBS = CocoaControlMBS1.View
dim r as NSRectMBS = NSMakeRectMBS(0, 0, 500, 500)
pvrTask.showRelativeToRect(r, v, pvrTask.MinXEdge)[/code]
No … I am using NSPopoverMBS somewhere else, but here I have hoped for something which simply makes a plain box window transparent and leaving the controls on it opaque.
OK, for macOS I found this code which works for me:
[code]Const Cocoa = “Cocoa”
Declare Sub setOpaque Lib Cocoa selector “setOpaque:” (id As Integer, b As Boolean)
Declare Function NSClassFromString Lib Cocoa (aClassName As CFStringRef) As Ptr
Declare Function clearColor Lib Cocoa selector “clearColor” (NSColorClass As Ptr) As Ptr
Declare Sub setBackgroundColor Lib Cocoa selector “setBackgroundColor:” (w As Integer, c As Ptr)
//allow for transparency by setting opaqueness false
setOpaque(Self.Handle, False)
//set the background completely transparent
setBackgroundColor(self.Handle, clearColor(NSClassFromString(“NSColor”)))[/code]
kudos to Will Shank
https://forum.xojo.com/18739-make-sheet-window-transparent/p1#p157078
This one?
[code]'make transparent
dim t As integer = self.MakeTransparentMBS
self.HasNoTitleBarMBS = true
self.HasBorderMBS = true
'make the pic for the background
dim Pic as Picture
if IsDarkMode then
Pic = mailbox_name_change_dm
else
Pic = mailbox_name_change
end if
dim Mask as Picture = mailbox_name_change_mask
WindowPic = CGCreateImageMBS(Pic, Mask)
self.Height = mailbox_name_change.Height
self.Width = mailbox_name_change.Width
CLabel.Invalidate 'otherwise label will not show
[/code]
Needs a pic with a mask, though.
You can decide wether OverlayMBS helps you.
Or a normal Xojo window made transparent.