Mac Tabbar issue with window position

We have a window with a listbox one column with multiple rows. If we click a cell we want to have another window displayed over the top of the cell.

We are finding that the window.top values are incorrect first time round until we move the main window. It looks like top is short by around the size of the tab bar.
This is Mac OS only and this isn’t an issue when the preferred tabbing option it turn to manual.

Has anyone else seen this, any way to get around this?

I have this declare disable the tab bar on macOS for ARGen. If you don’t want the tab bar at all, see if this helps :slight_smile:

// https://forum.xojo.com/conversation/post/396640 source

#if TargetCocoa then
  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
  
#endif

The source thread is gone though :confused:

2 Likes

We would like the user to have the option, if possible. Is there a way to detect if the tabbar is enabled from xojo?

Yes, this declare (which is part of the Ohanaware App Kit) will tell you if there is a tab bar present. However it doesn’t work on window.open (my guess is because the tab bar isn’t present on window.open).

#if targetMacOS and targetDesktop then
  // --- Extracted from the Ohanaware App Kit by Sam Rowlands, Nov 10th 2020.
  declare Function NSWindowTabbedWindows lib "AppKit" selector "tabbedWindows" ( NSWindowInstance as integer ) as integer
  hasTabBar.value = NSWindowTabbedWindows( me.trueWindow.handle ) <> 0
#endIf
1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.