Window Transparency? (Vibrancy)

Hi,
I have just viewed my app in Yosemite, and noticed that only sheet windows have the semi-transparency?
Is it not possible in Xojo, to make other windows semi-transparent too? Or is this expected?

I was under the impression that all windows in the new OS had the semi-transparency?
hope someone can advise.

Thank you all in advance.

you can for example use window.TransparencyMBS to make window transparent.

But often you may want to have no transparency in controls, but background be partly transparent.
This may be more difficult.

[quote=136059:@Richard Summers]I have just viewed my app in Yosemite, and noticed that only sheet windows have the semi-transparency?
Is it not possible in Xojo, to make other windows semi-transparent too? Or is this expected?

I was under the impression that all windows in the new OS had the semi-transparency?
hope someone can advise.[/quote]

Open TextEdit : no transparency in the window or menu
Mail : same thing
etc.

Seems transparency is not required at all for apps windows.

Sam Rowlands has shared precious techniques to create Yosemite style transluscency in Xdev :
https://gumroad.com/l/DXbT

In a window’s Open event:

Declare Sub setAlphaValue Lib "Cocoa" Selector "setAlphaValue:" (NSWindow As Ptr, alphaValue As Single) setAlphaValue(Ptr(Self.Handle), 0.5)

[quote=136076:@Eli Ott]In a window’s Open event:

Declare Sub setAlphaValue Lib "Cocoa" Selector "setAlphaValue:" (NSWindow As Ptr, alphaValue As Single) setAlphaValue(Ptr(Self.Handle), 0.5)[/quote]

This is a nice way to render the entire window transparent.

But Yosemite way is different. Windows are not transparent, they are transluscent. A bit like a glass you blow your breath on. Things behind them appear foggy.

And if the background is transluscent, controls remain opaque.

I just experimented quickly by modifying macoslibSplashWindow in the MacOSLib master project.

Setting nsw.Transparency = 0.8 in open creates a partially transparent background, but controls on the window remain opaque.

It is not exactly the same as Yosemite transluscency, but could be close enough for some apps.

I don’t have Yosemite to test (yet) but it looks like this may be what you are looking for:
https://developer.apple.com/library/mac/documentation/Foundation/Reference/NSVisualEffectView_Class/index.html
Note that it will only work in Yosemite.

Thanks guys - interesting information.
Jason, that seems like exactly what I was referring to. All we need now is a genius to convert that into a declare :slight_smile:

Thank you everyone - much appreciated.

NSVisualEffectView is a selector of NSView, which is a part of MacOSLib. Chances are Christian will soon have plugins for that.

And this is no doubt what Sam Rowlands is using.

I can try and create the class with declares later today or tomorrow, but someone else will have to test it because I don’t have Yosemite on any of my machines yet.

John Siracusa’s Yosemite review covered where translucency should be expected and where it shouldn’t. Never in main windows.

“Vibrancy” (what Apple calls the translucency) below toolbars(1) is one of the places where Yosemite will prove difficult in Xojo (since below the toolbar the actual content is supposed to be affecting the translucency). The other one will be controls and toolbars in window titles (2).

(1) http://tinyurl.com/kg8z3oy

(2) http://tinyurl.com/o8qu4p5

(I would’ve embedded the images, but esotalk doesn’t understand @ signs in URLs and its parser breaks. Same goes for clicable links, sorry)

Not sure why you think that Xojo won’t handle the toolbar properly
We DO use a native toolbar
As far as I know thats one reason that its NOT set up to be customizable etc yet as that infrastructure in Cocoa is … well … a horrid API to make it work in Xojo in a way that won’t give everyone fits

Controls in the tool bar, IF you use real Cocoa controls (NSButton etc), should behave similarly

Much of Cocoa assumes you’re using only Apple’s frameworks, like AppKit, and Xcode and stepping slightly outside that bounding box is painful.
From that perspective Carbon was a much nicer API for what we do - ask Joe about it sometime :slight_smile:

Wonderful. I shall test it right away and report.

Example 1 is most interesting. I naively thought vibrancy was transluscency, I was wrong. It appears to be a combination of transluscency with a fogged rendition of what lies behind the window, and a reflection of the content, as well demonstrated by the green, red and blue landscape reflecting in the toolbar.

The same occurs with the map below.

Interestingly enough, the reflection does not manifest on the left pane of the Desktop Pictures window, which seems to be exclusively transparency.

Both seem at first glance very difficult to emulate, would it be to mimic Yosemite under Mavericks…

[quote=136137:@Norman Palardy]Not sure why you think that Xojo won’t handle the toolbar properly
We DO use a native toolbar[/quote]

[quote=136138:@Michel Bujardet]Example 1 is most interesting. I naively thought vibrancy was transluscency, I was wrong. It appears to be a combination of transluscency with a fogged rendition of what lies behind the window, and a reflection of the content, as well demonstrated by the green, red and blue landscape reflecting in the toolbar.

The same occurs with the map below.[/quote]

Yes. This is what I meant.

In the first example the toolbar is not reflecting the content but showing the content that lies “behind” the toolbar. I can’t demonstrate because this iMac doesn’t even support translucency.

In the second example the window’s title bar is integrating the toolbar controls.

Neither of these can be done with the native toolbar Xojo indeed supports, to the best of my knowledge, at this point. The first one even requires content to exist behind the toolbar (unless I’m wrong and misinterpreting what it’s doing).

Two more examples (now embedded since Norman has shown tinyurl redirected urls work just as the final URLs themselves)

Yes. You are right. The window area is behind the toolbar. It is not a reflexion.

Indeed it does not seem possible with the Xojo toolbar, since the window area starts below it.

It would probably require a canvas custom toolbar to approximate.

[quote=136162:@Michel Bujardet]Indeed it does not seem possible with the Xojo toolbar, since the window area starts below it.

[/quote]
I have just recently found a hint on how to extend the area to the toolbar. Will see if I can find it again

And it’s funny Apple is giving hints on missing declarations. The background color being part of that too …

Interesting but I literally just yesterday scrubbed a drive clean and installed the release and mine looks nothing like the images posted
By default there doesn’t seem to be much translucency applied
I just booted it up now to see the differences but I can’t spot any translucency in the various apps mentioned

Ah yes: found it here (how to extend the vibrancy to the toolbar)
http://stackoverflow.com/questions/24414483/nsvisualeffectview-in-windows-title-bar

[code]You need to modify your window’s stylemask to include NSFullSizeContentViewWindowMask so that its content view can “overflow” into it.

You can easily accomplish this by adding this line to your AppDelegate:

self.window.styleMask = self.window.styleMask | NSFullSizeContentViewWindowMask;[/code]

@Norman: Sometimes the effect is very subtle. On a hard color contrast clearly visible though
(BlendingModeBehind works without setWantsLayer):

In the content region sure I’ve seen that
But not the toolbar like Eduardo was showing
At least not in the clean install of 10.10 I just had running

And since the toolbar & windows etc are native you can very likely use a declare to set them to behave similarly
You can’t just by dropping one on a window or opening a window but that what declares are for :slight_smile: