Sierra auto-tabbing?

Has anyone seen their Xojo-built app handle Sierra’s new automatic window tabbing function?

Sierra’s supposed to take normal apps (pre-Sierra) and automatically enable tabbed windows. Mine doesn’t seem to have tabs available.

Am I missing something?

Also, if we are to mod our apps to support OS-level tabbing, are there additional things we can do to support them (like a command-T choice in the File menu)?

It’s only automatic if you make a NSDocument based app in Xcode and build against 10.12.

For everything else, there’s an XDev article coming in the next edition.

Once Sierra ships, more things will become clear as documentation gets publicly available.

In the latest http://www.xdevmag.com I give you an example of how to add Sierra’s Tabbed Windows.

Automatic window tabbing is working for me with Xojo and even my old Xojo apps without me doing anything. It’s a bit unnerving at first since it seems the action didn’t happen as the new window is not a separate window but a tab. You can tear a tab off into a separate window if required.

The other issue is that it often slides the contents of your window down to make allowance for the height of the tab, meaning your lower buttons are half hidden. A window resize fixes this, but it’s a bit of a UI glitch. I hope this will be fixed before the final release.

It’s nice having two Xojo apps and the Reference guide all in one full-screen window.

Thanks for the article Sam - and the heads up. It’s a bit disappointing that Xojo / RB apps don’t automatically take advantage of tabbing as Apple is purporting them to… though…

@David Cox - Any ideas why your apps are supporting tabbing? Do you have a “View” menu in your apps?

Sam’s article describes how to alter Xojo apps so they can respond to Sierra’s auto-tabbing but it also says that the alterations are necessary and implies that without them it won’t happen…

So I’m confused now…

I’m also a bit disappointed that Xojo folks haven’t stepped up to help out / explain here.

In the System Preferences I set auto-tabbing to Always:

Now even Xojo supports it:

I have done nothing to support tabbing and I haven’t read the XDev Mag PDF yet.

Oh goodie MDI for the Mac :stuck_out_tongue:

I can see I’ll bet setting that to NEVER (or manually)

So is there any chance we can get Xojo to automatically send a resized event to all of the windows in the tab in this situation? Looks like adding/removing tabs or opening a new window within a tab causes any normal windows to not resize elements and gets the bottom cut off until the window is manually resized.

Put in a FR for that, it sounds quite reasonable.
I don’t know Xojo’s beta-os policy, but at least the note will be in the system.

<https://xojo.com/issue/45107>

[quote=285069:@David Cox]In the System Preferences I set auto-tabbing to Always:

[/quote]

I completely missed that! Thanks for pointing it out.

But, as with all things, it’s apparently not going to be that simple.

In a newer app (from Xojo 2015.4) tabs are automatically used. But in an older app (RB 2011.3) they are not.

Does anyone know what might have changed? Is it in my code or some update to Xojo?

Actually, I just realized that the newer one is Cocoa, the older is Carbon, perhaps that’s it?

To be clear, I haven’t decided if I like the new feature or not, I’m just anticipating “feedback” about it from users so I’d like to be prepared.

TIA

@David Cox & @ Steve Upton

With the screenshot from Xojo, you can see that this is only partial. It’s missing the new tab button. This is where the code in the xDev article comes into play. The article also illustrates how to handle macOS gestures and gives you the code to ‘projectCyborg’ which can help capture macOS events for other functions that you might like to add in the future.

Completed Cocoa support?

@Sam Rowlands Thanks for your efforts on tab support in the xDev article. Have you (or anyone else here) had success with disabling the tabs on specific windows? Certain windows in my app aren’t well suited to the tab experience.

Perhaps using a declare to call allowsAutomaticWindowTabbing

I wouldn’t recommend this particular property as it’s a class property, in Xojo all your window instances share the same XOJWindow NSClass, so this would prevent tabbing from working on ALL windows.

A quick like at the new document (which keeps reverting to Swift, I know Obj-C not Swift) says that the instance property ‘tabbingMode’ should be the one that you’re after.

I don’t have Sierra’s headers on this machine, so I can’t look up the property type. Which means that either someone else can follow my directions, or it’ll have to wait until I’m back in my own office and can try taking a look at Sierra again.

@Sam Rowlands Thanks for the context around the class property. Any assistance you can provide on this would be much appreciated!

Here is a declare to disable tab support on a per window basis with MBS’s version check to ensure it runs on Sierra only. W as the window you want it to apply to.

[code] if SystemInformationMBS.isSierra then

Declare Sub setTabbingMode Lib "Cocoa" Selector "setTabbingMode:" (obj as Integer, m as Integer)

setTabbingMode (w.handle, 2)

end if[/code]

[quote=292994:@Ian Page]Here is a declare to disable tab support on a per window basis with MBS’s version check to ensure it runs on Sierra only. W as the window you want it to apply to.

[code] if SystemInformationMBS.isSierra then

Declare Sub setTabbingMode Lib "Cocoa" Selector "setTabbingMode:" (obj as Integer, m as Integer)

setTabbingMode (w.handle, 2)

end if[/code][/quote]

If you’re going to use MBS anyway, you might as well use the latest 16.5 prerelease plugins which have support for this instance property:

// Do this before the window is displayed if SystemInformationMBS.isSierra then dim n as NSWindowMBS = window1.NSWindowMBS n.tabbingMode = n.NSWindowTabbingModeDisallowed end if

Or also the class property:

// I use this in App.open if SystemInformationMBS.isSierra then NSWindowMBS.allowsAutomaticWindowTabbing = false end if

IMO, the tabbingMode property needs to be exposed as a Window checkbox in the Inspector or it’s going to cause a lot of sucky looking Xojo apps. <https://xojo.com/issue/45107>

Thanks. I just added those for a client and now others can use them, too :slight_smile: