macOS adopted an interesting behaviour some time ago where when you opened a new window in an application. It would default to opening a new tab in the window instead of opening a new window.
If your application could not deal with this and the user had the preference in System Preferences > Dock > Prefer Tabs when opening documents set to Always then it could cause your app issues.
You can opt out of this behaviour in your app’s open event.
Public Sub AppAutoTabbing(optIn as boolean)
#if not TargetMacOS
#pragma unused optIn
#endif
#if TargetMacOS
Declare Function NSClassFromString Lib "Cocoa" (name As CFStringRef) As Ptr
Dim nsWindowClass As ptr = NSClassFromString( "NSWindow" )
if nsWindowClass = nil then
// msgbox CurrentMethodName + " nsWindowClass is Nil"
break
return
end if
declare sub EnableTabGrouping lib "AppKit"selector "setAllowsAutomaticWindowTabbing:" ( classPtr as Ptr , enableDisable as Boolean )
EnableTabGrouping( nsWindowClass, optIn )
#endif
End Sub
Earlier today I turned on System Preferences > Dock > Prefer Tabs = “Always”, to see what would happen with the app I’m building.
Eventually I saw how a new MessageDialog opened as a tab in my app (and added a tab-bar), instead of the stand-alone modal dialog I was expecting.
Your code appears to have fixed the issue.
Thanks again for the tips Norman, they’re very helpful.