TitleBar with Controls

I know it’s been discussed many times, but I was digging through some header files tonight and came across something I’d seen in the Yosemite release notes, but didn’t quite grasp at the time…

NSTitlebarAccessoryViewController

It’s not in the online docs, but it IS in the header files.

Here’s the project!
AccessoryView.xojo_binary_project
You would need to use constraints or autoresizingMask to get it to resize… If you lock left and right in the IDE it freezes during width resize.

(In FullScreen, the top section becomes the menubar pushed to the right, and the popupmenu reveals when you mouse to the top of the screen.)

[quote=159507:@jim mckay]I know it’s been discussed many times, but I was digging through some header files tonight and came across something I’d seen in the Yosemite release notes, but didn’t quite grasp at the time…

NSTitlebarAccessoryViewController

It’s not in the online docs, but it IS in the header files.

Here’s the project!
AccessoryView.xojo_binary_project
You would need to use constraints or autoresizingMask to get it to resize… If you lock left and right in the IDE it freezes during width resize.

(In FullScreen, the top section becomes the menubar pushed to the right, and the popupmenu reveals when you mouse to the top of the screen.)[/quote]

Thank you Jim :slight_smile:

A backwards compatible alternative is to use a toolbar and insert the individual controls into the toolbar buttons.

Depending on how you lay out your interface you can achieve a very similar effect, while still allowing your app to run on Mavericks, Mountain Lion and Lion.

Although one key advantage of the NSTitlebarAccessoryViewController, is that it can be automatically hidden in Full Screen mode, while a toolbar takes more work.

[quote=159807:@Sam Rowlands]A backwards compatible alternative is to use a toolbar and insert the individual controls into the toolbar buttons.

Depending on how you lay out your interface you can achieve a very similar effect, while still allowing your app to run on Mavericks, Mountain Lion and Lion.

Although one key advantage of the NSTitlebarAccessoryViewController, is that it can be automatically hidden in Full Screen mode, while a toolbar takes more work.[/quote]

So NSTitlebarAccessoryViewController is only compatible with Yosemite ? Would not it be possible to simply use #if #Endif to display another window using older methods in case of older systems ?

#IF ~ #End If are for the Xojo compiler only.

However as Cocoa declares are soft linked, you can use a method to detect if you’re running on Yosemite or not.

I’ve posted several methods to the forum, hard to look up right now as I’m on my mobile.

How?

see Eli’s code here https://forum.xojo.com/conversation/post/158091
and a little bit down Axel posted a project.

That’s the one, I’m not saying that we should use this method instead btw, just offering it as an alternative to a Yosemite only function.