PB v6.xx - Wrong StatusBar Position with use ToolBar
Posted: Tue Aug 12, 2025 11:51 am
When using StatusBar and ToolBar, the StatusBar is set to the wrong position during window creation.
After large change from the window, this is correct again.
Probably still have to adjust the calculation to the new macOS standard size from the ToolBar (24x24 pixels)
After large change from the window, this is correct again.
Probably still have to adjust the calculation to the new macOS standard size from the ToolBar (24x24 pixels)
Code: Select all
;-TOP
Procedure UpdateWindow()
Protected dx, dy
dx = WindowWidth(0)
dy = WindowHeight(0) - StatusBarHeight(0) - MenuHeight()
; Resize Gadgets
EndProcedure
Procedure Main()
Protected dx, dy
#WinStyle = #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget
If OpenWindow(0, #PB_Ignore, #PB_Ignore, 600, 400, "Test Window", #WinStyle)
; MenuBar
CreateMenu(0, WindowID(0))
MenuTitle("&File")
MenuItem(99, "E&xit")
; StatusBar
CreateStatusBar(0, WindowID(0))
AddStatusBarField(#PB_Ignore)
StatusBarText(0, 0, " Label")
; ToolBar
CreateImage(0, 22, 22, 32, #Red)
CreateToolBar(0, WindowID(0))
ToolBarImageButton(0, ImageID(0))
; Gadgets
dx = WindowWidth(0)
dy = WindowHeight(0) - StatusBarHeight(0) - MenuHeight()
; Bind Events
BindEvent(#PB_Event_SizeWindow, @UpdateWindow(), 0)
; Main Loop
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Select EventWindow()
Case 0
Break
EndSelect
Case #PB_Event_Menu
Select EventMenu()
Case 99, #PB_Menu_Quit
PostEvent(#PB_Event_CloseWindow, 0, 0)
EndSelect
Case #PB_Event_Gadget
Select EventGadget()
EndSelect
EndSelect
ForEver
EndIf
EndProcedure : Main()