# Double titles on Mac Document windows

**URL:** <https://forum.xojo.com/t/double-titles-on-mac-document-windows/69422>\
**Category:** macOS\
**Created:** [April 4, 2022, 9:04am UTC](https://forum.xojo.com/t/double-titles-on-mac-document-windows/69422 "2022-04-04T09:04:16Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeff\_Tullin](https://forum.xojo.com/user_avatar/forum.xojo.com/jeff_tullin/32/693_2.png) [@Jeff\_Tullin](https://forum.xojo.com/u/Jeff_Tullin)\
**Post date:** [April 4, 2022, 9:04am UTC](https://forum.xojo.com/t/double-titles-on-mac-document-windows/69422/1 "2022-04-04T09:04:17Z")

</div>

In recent times, one of my Mac Apps has started having ‘two titles’

 ![image](https://forum.xojo.com/uploads/default/original/2X/9/9b7a272a88f791d43fd3524d258a1109077faab5.png)

I cannot work out why this happens, or how to stop it.  
The second one was showing as a full path when I have code to try to set the setTitleWithRepresentedFilename

---

<div class="post-metadata">

**Author:** ![Emile\_Schwarz](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/90ced4/32.png) [@Emile\_Schwarz](https://forum.xojo.com/u/Emile_Schwarz)\
**Post date:** [April 4, 2022, 10:14am UTC](https://forum.xojo.com/t/double-titles-on-mac-document-windows/69422/2 "2022-04-04T10:14:47Z")

</div>

I got tabed windows (two of my windows inside one)…

But that is the first time I saw that one. 🥹

---

<div class="post-metadata">

**Author:** ![Jeff\_Tullin](https://forum.xojo.com/user_avatar/forum.xojo.com/jeff_tullin/32/693_2.png) [@Jeff\_Tullin](https://forum.xojo.com/u/Jeff_Tullin)\
**Post date:** [April 4, 2022, 10:19am UTC](https://forum.xojo.com/t/double-titles-on-mac-document-windows/69422/3 "2022-04-04T10:19:42Z")

</div>

I can more or less understand when there are are two document windows  
OSX is (trying) to be helpful. I hate it, however

But _this happens even when there is only one document window open_… there is nothing to tab to…

I could cope with tabbing when it happens, if only Xojo would provide a resized event.  
It doesn’t, so the bottom 8mm of my windows disappear when this happens, unless I manually resize afterwards. (Thats awful!)

---

<div class="post-metadata">

**Author:** ![TimStreater](https://forum.xojo.com/user_avatar/forum.xojo.com/timstreater/32/586_2.png) [@TimStreater](https://forum.xojo.com/u/TimStreater)\
**Post date:** [April 4, 2022, 10:22am UTC](https://forum.xojo.com/t/double-titles-on-mac-document-windows/69422/4 "2022-04-04T10:22:26Z")

</div>

> [@Jeff\_Tullin](#):
>
> I could cope with tabbing when it happens, if only Xojo would provide a resized event.  
> It doesn’t, so the bottom 8mm of my windows disappear when this happens, unless I manually resize afterwards. (Thats awful!)

For Window and DesktopWindow, there is a Resized event.

---

<div class="post-metadata">

**Author:** ![Jeff\_Tullin](https://forum.xojo.com/user_avatar/forum.xojo.com/jeff_tullin/32/693_2.png) [@Jeff\_Tullin](https://forum.xojo.com/u/Jeff_Tullin)\
**Post date:** [April 4, 2022, 10:23am UTC](https://forum.xojo.com/t/double-titles-on-mac-document-windows/69422/5 "2022-04-04T10:23:14Z")

</div>

> For Window and DesktopWindow, there is a Resized event.

Which does not fire if an existing window is moved into a tab configuration.

Specifically, I have a status bar at the bottom of a document window  
while the window stands alone, it is visible.

If a second window is opened, both windows are tabbed, and the available height is smaller than it was before.  
The first window does not get a resized event, and believes it has not changed.  
The status bar lies outside/ is drawn below the available area.  
If I resize the grouped window, all child windows get a resized event.

This call _should_ stop it happening, but doesn’t  
setAllowsAutomaticWindowTabbing

---

<div class="post-metadata">

**Author:** ![Jeff\_Tullin](https://forum.xojo.com/user_avatar/forum.xojo.com/jeff_tullin/32/693_2.png) [@Jeff\_Tullin](https://forum.xojo.com/u/Jeff_Tullin)\
**Post date:** [April 4, 2022, 10:30am UTC](https://forum.xojo.com/t/double-titles-on-mac-document-windows/69422/6 "2022-04-04T10:30:44Z")

</div>

[https://xojo.com/issue/52749](https://xojo.com/issue/52749)

verified but ignored(?) 4 years ago.

---

<div class="post-metadata">

**Author:** ![Greg\_O](https://forum.xojo.com/user_avatar/forum.xojo.com/greg_o/32/22785_2.png) [@Greg\_O](https://forum.xojo.com/u/Greg_O)\
**Post date:** [April 4, 2022, 11:18am UTC](https://forum.xojo.com/t/double-titles-on-mac-document-windows/69422/7 "2022-04-04T11:18:14Z")

</div>

Xojo doesn’t support Apple’s tabbed windows at the moment so I wouldn’t expect it to handle adjusting the size correctly either, but that’s exactly what this is. When tabs are enabled for your app, each tab also has its own name… even if there’s only one.

---

<div class="post-metadata">

**Author:** ![Greg\_O](https://forum.xojo.com/user_avatar/forum.xojo.com/greg_o/32/22785_2.png) [@Greg\_O](https://forum.xojo.com/u/Greg_O)\
**Post date:** [April 4, 2022, 11:21am UTC](https://forum.xojo.com/t/double-titles-on-mac-document-windows/69422/8 "2022-04-04T11:21:14Z")

</div>

> [@Jeff\_Tullin](#):
>
> setAllowsAutomaticWindowTabbing

Could you show the code that includes this declare?

---

<div class="post-metadata">

**Author:** ![Greg\_O](https://forum.xojo.com/user_avatar/forum.xojo.com/greg_o/32/22785_2.png) [@Greg\_O](https://forum.xojo.com/u/Greg_O)\
**Post date:** [April 4, 2022, 11:27am UTC](https://forum.xojo.com/t/double-titles-on-mac-document-windows/69422/9 "2022-04-04T11:27:28Z")

</div>

Sorry… after reading a little more, it looks like you need

```auto
Declare Sub SetTabbingMode Lib "AppKit" selector "setTabbingMode:" (obj as Ptr, value as integer)

SetTabbingMode(w.handle, 2) // 2 = Disabled

```

If you’re using API 1, you’ll need to change` obj as Ptr` to `obj as Integer`

---

<div class="post-metadata">

**Author:** ![Jeff\_Tullin](https://forum.xojo.com/user_avatar/forum.xojo.com/jeff_tullin/32/693_2.png) [@Jeff\_Tullin](https://forum.xojo.com/u/Jeff_Tullin)\
**Post date:** [April 4, 2022, 11:36am UTC](https://forum.xojo.com/t/double-titles-on-mac-document-windows/69422/10 "2022-04-04T11:36:09Z")

</div>

Thanks Greg.  
I have used this, and what seems to be the same call from MBS plugins, in the  
Open event of my window

and both before and after the super.consructor call in a subclass of the same window

In all cases, the first window opened has the double title, the second and third windows dont.

System preferences are set to ‘never’

 ![image](https://forum.xojo.com/uploads/default/original/2X/e/e2a851352680b49923faaf81a25ee9f518b122fa.png)

The **setAllowsAutomaticWindowTabbing** code is:

```auto

  Declare Function NSClassFromString Lib "Cocoa" (s As CFStringRef) As Ptr
  Declare Function NSSelectorFromString Lib "Cocoa" (s As CFStringRef) As Ptr
  Declare Sub setAllowsAutomaticWindowTabbing Lib "Cocoa" selector "setAllowsAutomaticWindowTabbing:" (cls As Ptr, ena As Boolean)
  Declare Function respondsToSelector Lib "Cocoa" selector "respondsToSelector:" (p As Ptr, sel As Ptr) As Boolean
  Dim nswCls As Ptr = NSClassFromString ("NSWindow")
  If respondsToSelector (nswCls, NSSelectorFromString ("setAllowsAutomaticWindowTabbing:")) Then
    setAllowsAutomaticWindowTabbing (nswCls, False)
  End If

```

---

<div class="post-metadata">

**Author:** ![Greg\_O](https://forum.xojo.com/user_avatar/forum.xojo.com/greg_o/32/22785_2.png) [@Greg\_O](https://forum.xojo.com/u/Greg_O)\
**Post date:** [April 4, 2022, 12:54pm UTC](https://forum.xojo.com/t/double-titles-on-mac-document-windows/69422/11 "2022-04-04T12:54:35Z")

</div>

Have you tried the setTabbingMode call I created there? The handle should be the handle of the window.

---

<div class="post-metadata">

**Author:** ![Jeff\_Tullin](https://forum.xojo.com/user_avatar/forum.xojo.com/jeff_tullin/32/693_2.png) [@Jeff\_Tullin](https://forum.xojo.com/u/Jeff_Tullin)\
**Post date:** [April 4, 2022, 1:12pm UTC](https://forum.xojo.com/t/double-titles-on-mac-document-windows/69422/12 "2022-04-04T13:12:42Z")

</div>

I have.  
It appears equivalent to the MBS call I also tried

```auto

    dim n as NSWindowMBS = self.NSWindowMBS 
    n.tabbingMode = n.NSWindowTabbingModeDisallowed 

```

It is now randomly happening on the first window only.  
I’ll try restarting the Mac.

I note the request for Xojo to handle the sizing after tabbing occurs actually dates back to 2016.  
I guess it will never be addressed.

---

<div class="post-metadata">

**Author:** ![Arnaud\_N](https://forum.xojo.com/user_avatar/forum.xojo.com/arnaud_n/32/21824_2.png) [@Arnaud\_N](https://forum.xojo.com/u/Arnaud_N)\
**Post date:** [April 4, 2022, 5:12pm UTC](https://forum.xojo.com/t/double-titles-on-mac-document-windows/69422/13 "2022-04-04T17:12:45Z")

</div>

> [@Jeff\_Tullin](#):
>
> I’ll try restarting the Mac.

It’s happening on a single Mac only?

---

<div class="post-metadata">

**Author:** ![Jeff\_Tullin](https://forum.xojo.com/user_avatar/forum.xojo.com/jeff_tullin/32/693_2.png) [@Jeff\_Tullin](https://forum.xojo.com/u/Jeff_Tullin)\
**Post date:** [April 4, 2022, 9:46pm UTC](https://forum.xojo.com/t/double-titles-on-mac-document-windows/69422/14 "2022-04-04T21:46:35Z")

</div>

Some customers too, but at least THIS one I can recreate on my own machine.

---

<div class="post-metadata">

**Author:** ![Ian\_Kennedy](https://forum.xojo.com/user_avatar/forum.xojo.com/ian_kennedy/32/6860_2.png) [@Ian\_Kennedy](https://forum.xojo.com/u/Ian_Kennedy)\
**Post date:** [April 5, 2022, 10:49am UTC](https://forum.xojo.com/t/double-titles-on-mac-document-windows/69422/15 "2022-04-05T10:49:23Z")

</div>

There is a setting in System Preferences \> General, for Prefer Tabs, which is typically set to Full Screen. Other options are Never and Always.

If Always is set and New open document window instruction gets routed to a New tab in the current Document window (unless your flags are set as above). Equally, if you go to full screen and create a new window it ends up in a tab if “Full Screen” option is chosen. When you come out of full screen the tabs remain. I’ve not seen a Tab on a single document in a window, that is unusual.

---

<div class="post-metadata">

**Author:** ![kevin\_g](https://forum.xojo.com/letter_avatar_proxy/v4/letter/k/65b543/32.png) [@kevin\_g](https://forum.xojo.com/u/kevin_g)\
**Post date:** [April 5, 2022, 10:55am UTC](https://forum.xojo.com/t/double-titles-on-mac-document-windows/69422/16 "2022-04-05T10:55:21Z")

</div>

We do this during the initialisation of our app and before any windows open when running on High Sierra and later and have not had any reports of tabs appearing:

NSWindowMBS.allowsAutomaticWindowTabbing = False

---

<div class="post-metadata">

**Author:** ![Jeff\_Tullin](https://forum.xojo.com/user_avatar/forum.xojo.com/jeff_tullin/32/693_2.png) [@Jeff\_Tullin](https://forum.xojo.com/u/Jeff_Tullin)\
**Post date:** [April 5, 2022, 1:14pm UTC](https://forum.xojo.com/t/double-titles-on-mac-document-windows/69422/17 "2022-04-05T13:14:11Z")

</div>

> [@Ian\_Kennedy](#):
>
> Other options are Never and Always.

Mine set to Never

> We do this during the initialisation of our app

Me too.  
Which is why this ‘one window showing a tab title even when there are no other tabs’ is so odd.

Hasn’t happened since a restart… may now remain a mystery forever.

Xojo should still fix the sizing messages.

---

<div class="post-metadata">

**Author:** ![Dirk\_Cleenwerck](https://forum.xojo.com/user_avatar/forum.xojo.com/dirk_cleenwerck/32/533_2.png) [@Dirk\_Cleenwerck](https://forum.xojo.com/u/Dirk_Cleenwerck)\
**Post date:** [May 7, 2024, 9:29am UTC](https://forum.xojo.com/t/double-titles-on-mac-document-windows/69422/18 "2024-05-07T09:29:16Z")

</div>

> [@Jeff\_Tullin](#):
>
> [https://xojo.com/issue/52749](https://xojo.com/issue/52749)

It’s still not fixed and that ticket has been archived.  
I’ve added comment in the hope it will be opened again.

---

<div class="post-metadata">

**Author:** ![Jeff\_Tullin](https://forum.xojo.com/user_avatar/forum.xojo.com/jeff_tullin/32/693_2.png) [@Jeff\_Tullin](https://forum.xojo.com/u/Jeff_Tullin)\
**Post date:** [May 7, 2024, 9:57am UTC](https://forum.xojo.com/t/double-titles-on-mac-document-windows/69422/19 "2024-05-07T09:57:41Z")

</div>

I don’t expect any bugs to get fixed these days.  
So when I find a workaround to something like this, it’s usually ‘in my code’ for life.

I use this in the Open event of my document windows:  
(and looking at it, I can probably drop the ‘isSierra’ by now!)

```auto
#if targetmacos then
  if SystemInformationMBS.isSierra then 
    dim n as NSWindowMBS = self.NSWindowMBS 
    n.tabbingMode = n.NSWindowTabbingModeDisallowed 
  end if
#endif

```

It only needs a new property for a Window object…

---

<div class="post-metadata">

**Author:** ![Dirk\_Cleenwerck](https://forum.xojo.com/user_avatar/forum.xojo.com/dirk_cleenwerck/32/533_2.png) [@Dirk\_Cleenwerck](https://forum.xojo.com/u/Dirk_Cleenwerck)\
**Post date:** [May 7, 2024, 9:59am UTC](https://forum.xojo.com/t/double-titles-on-mac-document-windows/69422/20 "2024-05-07T09:59:14Z")

</div>

Some of our customers prefer the tabbed window approach.  
I’ve disabled that as well, but it would be nice to be able to give them the experience they want.

[Next page](https://forum.xojo.com/t/double-titles-on-mac-document-windows/69422.md?page=2)
