Any advice for making this work better? My goal is to just give the vibrancy effect to this canvas. I want the canvas to still behave as normal, following Xojo locking rules, positioning, and so on.
#if TargetMacOS
Var View As New NSVisualEffectViewMBS(0, 0, Self.Width, Self.Height)
View.BlendingMode = NSVisualEffectViewMBS.NSVisualEffectBlendingModeBehindWindow
View.Material = NSVisualEffectViewMBS.NSVisualEffectMaterialAppearanceBased
View.State = NSVisualEffectViewMBS.NSVisualEffectStateFollowsWindowActiveState
View.AutoresizesSubviews = True
View.AutoresizingMask = NSViewMBS.NSViewMaxXMargin Or NSViewMBS.NSViewHeightSizable
Var ContentView As NSViewMBS = Self.NSViewMBS
Var RootView As NSViewMBS = ContentView.Superview
ContentView.RemoveFromSuperviewWithoutNeedingDisplay
View.AddSubview(ContentView)
RootView.AddSubview(View)
#endif
The issue, I believe, is the ContentView in this case is the canvas itself, and RootView is the window it is placed on. So when I move the canvas in Xojo, I’m actually moving the canvas inside the vibrancy view. Since the unmodified canvas has no child views, I can’t place the vibrancy view inside the canvas without obscuring the contents.