Toolbar position on TitleBar (issues)

Mac OSX specific forum
User avatar
mk-soft
Always Here
Always Here
Posts: 5313
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Toolbar position on TitleBar (issues)

Post by mk-soft »

Correlates the position of the ToolBar from TitleBar to TopLeft under Big Sur and higher.
Should perhaps be set as the default in the StatusBar Library.

Code: Select all

;-TOP by mk-soft, v1.01.0, 15.01.2022

If OpenWindow(0, 0, 0, 200, 50, "ToolBar", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  
  CreateImage(0,16,16)
  StartDrawing(ImageOutput(0))
  Box(0,0,16,16,RGB(255,255,255))
  Box(4,4,8,8,RGB(255,0,0))
  StopDrawing()
  
  CreateImage(1,16,16)
  StartDrawing(ImageOutput(1))
  Box(0,0,16,16,RGB(255,0,0))
  Box(4,4,8,8,RGB(255,255,255))
  StopDrawing()
  
  CompilerIf #PB_Compiler_OS = #PB_OS_MacOS
    If OSVersion() >= #PB_OS_MacOSX_10_14
      ; Fix Toolbar style from titlebar to expanded
      #NSWindowToolbarStyleAutomatic = 0      ; Auto
      #NSWindowToolbarStyleExpanded = 1       ; Top Left
      #NSWindowToolbarStylePreference = 2     ; Top Center
      #NSWindowToolbarStyleUnified = 3        ; TitleBar Large
      #NSWindowToolbarStyleUnifiedCompact = 4 ; TitleBar without text
      CocoaMessage(0, WindowID(0), "setToolbarStyle:", #NSWindowToolbarStyleExpanded)
    EndIf
  CompilerEndIf
  
  If CreateToolBar(0, WindowID(0))
    ToolBarImageButton(0,ImageID(0))
    ToolBarImageButton(1,ImageID(1))
  EndIf
  
  Repeat
  Until WaitWindowEvent() = #PB_Event_CloseWindow 
  
EndIf
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive