Setting the window background appearance in Yosemite

My unified windows, which use the metal framework, don’t look right in Yosemite. I’d like to have the flatter Yosemite appearance. Can I achieve that with declares? setStyleMask looks promising, but I haven’t been able to get the right look.

What do you mean by the flatter appearance? If you create a new project and run it does the window presented have the flatter appearance you want? Xojo uses native NSWindow’s so they will automatically inherit the Yosemite appearance unless you have changed the style (i.e. use metal). All of the window’s I see have the yosemite appearance. Change Window Type in the inspector under Frame to Document and you will have the default yosemite appearance for your windows.

Yes, I use the Metal Window option, which is needed for the unified window look. The window is a compound window, like iTunes or Mail.

Jason’s right, in Yosemite, Apple focused on the default look with the default controls. Which means if you change the window type or button type to anything but default it looks wrong. Buttons are the worst as certain types no longer have a enabled/disabled graphics, meaning that the user can’t tell the difference!

I would suggest is that you set your interface to use the default controls, then on a OS version lower than 10.10 (as there might be a 10.9.6) use code to make it look like it currently does.

In theory you should be able to alter the appearance in Xojo code:

me.frame = window.frameTypeMetal

But I can’t get it to work.

In fact, I’ve just spent a few minutes messing with setStyleMask, and I can’t get that to work correctly on 10.9.5 either… There is a declare, to which I can’t recall at the moment… Here’s the code I wrote, which doesn’t work as expected.

declare function mStyleMask lib "Cocoa" selector "styleMask" ( ref as integer ) as integer declare sub mSetStyleMask lib "Cocoa" selector "setStyleMask:" ( Ref as integer, inValue as integer ) const NSTexturedBackgroundWindowMask = 256 const NSUnifiedTitleAndToolbarWindowMask = 4096 mSetStyleMask( me.handle, mStyleMask( me.handle ) + NSTexturedBackgroundWindowMask + NSUnifiedTitleAndToolbarWindowMask )