Appkit IsTabBarVisible Function

Working on a XOJO function to detect if the tab bar is visible. Appkit has IsTabBarVisible. Has anyone been able to get this function to operate? I am obviously missing something obvious! Any insights most welcome. The following code is directional, not functional.

[code]#If TargetCocoa Then

Declare Function getIsTabBarVisible Lib “AppKit” selector “IsTabBarVisible” (NSWindowID As Ptr) As Boolean

Return getIsTabBarVisible(ptr(w.handle))

#EndIf[/code]

I’m using MacOS tabs inspiration from @Sam Rowlands and am struggling along with others on knowing if/when a tabbed window shows or hides the tab bar.

Also, sort of wondering if its possible for the XOJO App HandleAppleEvent to get a message from the tab controller? Would that not be best way to approach this?

-be well

I think the first problem is that you are passing it the handle of a window instead of what the method wants… a NSWindowTabGroup.

I think you’re going to need an additional declare:

Declare Function getTabGroup Lib "AppKit" selector "tabGroup" (NSWindowID as Ptr) as Ptr

and then do something like this:

var group as ptr = getTabGroup(Ptr(w.handle))
If group = nil Then
    Return False
End If
Return IsTabBarVisible(group)
1 Like

Thank you Greg! Below is the working function.

Function IsTabBarVisible(w as window) As Boolean

Declare Function getTabGroup Lib "AppKit" selector "tabGroup" (NSWindowID As Ptr) As Ptr
Declare Function getIsTabBarVisible Lib "AppKit" selector "isTabBarVisible" (NSWindowID As Ptr) As Boolean

Var group As ptr = getTabGroup(Ptr(w.handle))
If group = Nil Then
  Return False
Else
  Return getIsTabBarVisible(group)
End If

End Function
1 Like