I want to use vibrancy in my window background and found the code below. It workes great when I compile it in a 32bit app, but if I do 64bit the NSRect is outside the window (bottom left) Does setAutoresizingMask works different in 64bit mode?
I can see the rect when I resize the window to the bottom left. It’s there but position and the resizing anchors are not correct.
Window.Open:
[code]#if targetmacos
declare function NSClassFromString lib CocoaLib (className as CFStringRef) as ptr
declare function alloc lib CocoaLib selector “alloc” (classRef as ptr) as ptr
dim EffectViewClass as Ptr = NSClassFromString (“NSVisualEffectView”)
if EffectViewClass <> NIL then // we have at least OS X 10.10
declare function initWithFrame lib CocoaLib selector “initWithFrame:” (id as ptr, frame as NSRect) as ptr
declare sub addSubViewRelativeTo lib CocoaLib selector “addSubview:positioned:relativeTo:” (id as ptr, view as ptr, position as integer, relativeTo as Ptr)
declare sub setAutoresizingMask lib CocoaLib selector “setAutoresizingMask:” (view as ptr, mask as integer)
dim frameRect as NSRect
frameRect.x = 0
frameRect.y = 0
frameRect.w = self.Width
frameRect.h = self.Height
dim WindowEffectView as new NSVisualEffectView(frameRect)
WindowEffectView.material = NSVisualEffectView.NSVisualEffectMaterial.NSVisualEffectMaterialLight //NSVisualEffectMaterialDark
setAutoresizingMask(WindowEffectView, 18)
Declare function contentView lib CocoaLib selector “contentView” (mwindow as integer) as ptr
dim contentViewPtr as ptr = contentView(self.Handle)
dim NSWindowBelow as Integer = -1
addSubViewRelativeTo(contentViewPtr, WindowEffectView, NSWindowBelow, nil)
end if
#endif[/code]