Page 3 of 3
Re: MenuHeight(), StatusBarHeight(), ToolBarHeight() returns
Posted: Wed Feb 01, 2017 9:59 am
by RASHAD
OK ,be happy
Code: Select all
;ToolBar Height
SendMessage_(ToolBarID(0), #TB_GETRECT, 0,r.RECT)
tbHeight = r\bottom-r\top
Code: Select all
;StatusBar Height
SendMessage_(StatusBarID(0), #SB_GETRECT, 0,r.RECT)
sbHeight = r\bottom-r\top
Re: MenuHeight(), StatusBarHeight(), ToolBarHeight() returns
Posted: Wed Feb 01, 2017 11:11 am
by Dude
RASHAD wrote:OK ,be happy
But I'm not, because the results don't match.
Code: Select all
; Run this on 5.51
hWnd=OpenWindow(0,200,200,400,195,"test",#PB_Window_SystemMenu)
CreateToolBar(0,hWnd)
CreateStatusBar(0,hWnd)
Debug MenuHeight() ; 20
Debug GetSystemMetrics_(#SM_CYMENU) ; 20
Debug ""
Debug ToolBarHeight(0) ; 28
SendMessage_(ToolBarID(0),#TB_GETRECT,0,r.RECT)
Debug r\bottom-r\top ; 0
Debug ""
Debug StatusBarHeight(0) ; 23
SendMessage_(StatusBarID(0),#SB_GETRECT,0,r.RECT)
Debug r\bottom-r\top ; 21
Re: MenuHeight(), StatusBarHeight(), ToolBarHeight() returns
Posted: Wed Feb 01, 2017 11:59 am
by RASHAD
You must populate the ToolBar
- Add vertical padding for ToolBar as 6 or exact as per the next code
- Add vertical padding for StatusBar as 2 or exact as per the next code
That is if you changed padding by yourself
Code: Select all
hWnd=OpenWindow(0,200,200,400,195,"test",#PB_Window_SystemMenu)
TB = CreateToolBar(0,hWnd)
ToolBarStandardButton(0, #PB_ToolBarIcon_New)
SB = CreateStatusBar(0,hWnd)
Debug MenuHeight() ; 20
Debug GetSystemMetrics_(#SM_CYMENU) ; 20
Debug ""
Debug ToolBarHeight(0) ; 28
SendMessage_(TB,#TB_GETRECT,0,r.RECT)
pad = SendMessage_(TB,#TB_GETPADDING,0,0)
Debug r\bottom-r\top + pad >> 16
Debug ""
Debug StatusBarHeight(0) ; 23
SendMessage_(SB,#SB_GETRECT,0,r.RECT)
Dim pad(2)
SendMessage_(SB,#SB_GETBORDERS,0,@pad())
Debug r\bottom-r\top + pad(1)
Re: MenuHeight(), StatusBarHeight(), ToolBarHeight() returns
Posted: Wed Feb 01, 2017 12:16 pm
by Dude
Thank you, RASHAD!
