Big Sur - changing NSWindow.AlphaValue causes Vibrancy in HTMLViewer

  • I have a window which does not show Vibrancy in normal operation.
  • However, the window also has a HTMLViewer, and when I show this control and load this with a video file, the video does show vibrancy, which is ugly and I want to turn vibrancy off.
  • I’m using WKWebViewMBSControl under Xojo 2019r1.1
  • when I look in the debugger, allowVibrancy is false:

Any idea how to disable vibrancy in a WKWebViewControlMBS?

Interesting, I think I figured it out.

I was using NSWindowMBS.AlphaValue() to do a nice window fade out - fade in effect.
It seems that once you have changed the alpha value, Vibrancy is enabled on the window, even if you set the Alpha back to 1.0 again.

@Christian_Schmitz - Can you think of a reason that setting alpha would permanently enable Vibrancy? Is there a way to un-do the change?

Digging deeper, this seems like a weird issue:

  • In Big Sur,
  • before the window has ever been Visible (e.g. .Show() has not yet been called)
  • if you set NSWindow.AlphaValue to a value below 1.0
  • then Vibrancy is enabled for the HTMLViewer on the Window
  • and remains on, even if you set NWSindow.AlphaValue back to 1.0

If, however, you make the window visible first, it’s possible to change the AlphaValue later on, and this does not seem to trigger Vibrancy.

Unfortunately, I was using this feature to make a nice animated fade-in of a window:

  • create window (visible=false)
  • load the HTMLViewer
  • set alpha to zero
  • animate window.alpha from 0 to 1

Update: I found a workaround, which is pretty hack-y, but does work:

  • Create the window (visible=false)
  • Move the window far offscreen (top = -30000)
  • show the window
  • set the window alpha to 0.0
  • hide the window

At this point, the window will function normally, and you can show and hide it and animate the Alpha value without trigggering unwanted Vibrancy.

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.