Safari Style Window Toolbar

Is it possible in Xojo to make a Safari style window toolbar - i.e. where the toolbar buttons are in-line with the traffic lights, rather than beneath them?

I found this post for custom titlebars. The examples shown in that post do not have the items in line with the traffic lights though.

Thanks Scott. I’m using the MBS toolbar functions at the moment - but was wanting to get a more space efficient version for some of my smaller windows.

Set titleVisibility to hidden. I’m guessing it’s in MBS, if not you will need a declare.

See here https://forum.xojo.com/10914-black-windows/0
I have experimented with the code used by Jim Mc Kay to place a canvas over the title bar (possibly the same as what you linked to). It works with a toolbar as well. You can place anything anywhere over the titlebar, including next to the traffic lights. The only thing one cannot is place anything on top of them, they will popup through.

I’ve been using this method for awhile now…
https://forum.xojo.com/conversation/post/200499

NSWindow has a method standardWindowButton which returns the traffic light widgets. This method just gets those and repositions them. When the Window is resized the traffic lights will snap back to default position so call the method in the Resized event too. So far they stay solidly in place.

I’ve only used this in non-toolbar windows. I got a report the method wasn’t working for someone but they fixed it on their own by “adding them as subviews”. Not really sure what they did.

I wrote about how to do this last year in the Xdev Magazine. I think it was 12.5.
http://www.xdevmag.com

It’s a lot simpler than you might think.

I use the same technique in most of our modern apps.

Oh, I misread the question. Put this in the windows Open event and the toolbar will shift up and to the right of the lights. Takes the captions away though.

[code]declare sub titleVis lib “Cocoa” selector “setTitleVisibility:” (id as integer, value As integer)

titleVis(self.Handle, 1) //0=Visible title, 1=Hidden title
[/code]

[quote]I wrote about how to do this last year in the Xdev Magazine. I think it was 12.5.
http://www.xdevmag.com [/quote]

Thanks Sam - it was 12.1 - very useful. And actually useful having to skim back through the other issues to find it, other useful info in there I’d forgotten - so thanks for providing the wrong number!

Hi James, sorry for the confusion. The article in 12.1 uses a trick to embed controls in the Window titlebar, which Apple now advise against with Yosemite and moving forwards.

In 12.5 (Sep/Oct 2014) I show you the Apple recommended way of doing it, whereby you add the controls to a toolbar, then set some Yosemite + options on the window and it can create an effect like a Safari toolbar (at the expense of the titlebar).

In 12.6 I cover it a bit more and use Backup To Go as an example.