ToolBar height ?
ToolBar height ?
hello, how can i get the height of the toolbar in my window ?
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
thanks denis, but that's not all folk !
Structure TBMETRICS not in purebasic includes, so here is :
And the constante #TB_GETMETRICS isn't defined so what's its value ?
Structure TBMETRICS not in purebasic includes, so here is :
Code: Select all
Structure TBMETRICS
cbSize.l
dwMask.l
cxPad.l
cyPad.l
cxBarPad.l
cyBarPad.l
cxButtonSpacing.l
cyButtonSpacing.l
EndStructureCode: Select all
ptbMetrics.TBMETRICS
ptbMetrics\cbSize = Sizeof( TBMETRICS )
SendMessage_( toolbar, #TB_GETMETRICS, 0, @ptbMetrics )No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
arrrg, in order to make it working i need those 3 API constantes :
#TBMF_PAD
#TBMF_BARPAD
#TBMF_BUTTONSPACING
as specified in MSDN documentation http://msdn.microsoft.com/library/defau ... etrics.asp
#TBMF_PAD
#TBMF_BARPAD
#TBMF_BUTTONSPACING
as specified in MSDN documentation http://msdn.microsoft.com/library/defau ... etrics.asp
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
this is how i coded it :
but it doesn't work (perhaps it works only with winXP )
but it doesn't work (perhaps it works only with winXP )
Code: Select all
Structure TBMETRICS
cbSize.l
dwMask.l
cxPad.l
cyPad.l
cxBarPad.l
cyBarPad.l
cxButtonSpacing.l
cyButtonSpacing.l
EndStructure
#TBMF_PAD = 1
#TBMF_BARPAD = 2
#TBMF_BUTTONSPACING = 4
#TB_GETMETRICS = #WM_USER + 101
;=================================
If OpenWindow(0,0,0,400,300,#PB_Window_ScreenCentered|#PB_Window_SystemMenu,"Toolbar")
toolbar = CreateToolBar( 0, WindowID() )
ToolBarStandardButton( 0, #PB_ToolBarIcon_Save )
ToolBarStandardButton( 1, #PB_ToolBarIcon_Delete )
CreateGadgetList( WindowID() )
ptbMetrics.TBMETRICS
ptbMetrics\cbSize = SizeOf( TBMETRICS )
ptbMetrics\dwMask = #TBMF_PAD
SendMessage_( toolbar, #TB_GETMETRICS, 0, @ptbMetrics )
Debug ptbMetrics\cxPad
Debug ptbMetrics\cyPad
ComboBoxGadget( 3, 5, ptbMetrics\cyPad+10, 200, 120 )
Repeat : Until WaitWindowEvent() = #WM_CLOSE
EndIf
Last edited by Flype on Sat Jul 26, 2003 5:56 pm, edited 1 time in total.
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
-
DominiqueB
- Enthusiast

- Posts: 103
- Joined: Fri Apr 25, 2003 4:00 pm
- Location: France
Hello
Just try:
#TBMF_BARPAD = 2
#TBMF_BUTTONSPACING = 4
#TBMF_PAD = 1
Dominique
#TBMF_BARPAD = 2
#TBMF_BUTTONSPACING = 4
#TBMF_PAD = 1
Dominique
Dominique
Windows 10 64bits. Pure basic 32bits
Windows 10 64bits. Pure basic 32bits
-
DominiqueB
- Enthusiast

- Posts: 103
- Joined: Fri Apr 25, 2003 4:00 pm
- Location: France
It works .
In fact it can't works for you under w2000 !
Minimum is xp for the structure TBMETRICS.
Said into wsdk.
I've XP pro and your sample code works well for me.
So sad .
Dominique.
Minimum is xp for the structure TBMETRICS.
Said into wsdk.
I've XP pro and your sample code works well for me.
So sad .
Dominique.
Dominique
Windows 10 64bits. Pure basic 32bits
Windows 10 64bits. Pure basic 32bits
-
Edwin Knoppert
- Addict

- Posts: 1073
- Joined: Fri Apr 25, 2003 11:13 pm
- Location: Netherlands
- Contact:
Little snap out of jaPBe:
Should work on all system.
Edit: on GetClientRect_() is rect\left rect\top always 0!
GPI
Code: Select all
ToolBarId=CreateToolBar(#tool_MainWindow,MainWin)
GetClientRect_(ToolBarId,rect.RECT)
ToolBarHeight=rect\bottom
Should work on all system.
Edit: on GetClientRect_() is rect\left rect\top always 0!
GPI
Last edited by GPI on Sat Jul 26, 2003 8:20 pm, edited 1 time in total.
yes, that's exactely what i want
and now it's so simple
:
and, so, the previous example works only on XP
I should forget it ...
and now it's so simple
Code: Select all
If OpenWindow(0,0,0,300,100,#PB_Window_ScreenCentered|#PB_Window_SystemMenu,"Toolbar")
toolbar = CreateToolBar( 0, WindowID() )
ToolBarStandardButton( 0, #PB_ToolBarIcon_Save )
ToolBarStandardButton( 1, #PB_ToolBarIcon_Delete )
CreateGadgetList( WindowID() )
GetClientRect_( toolbar,rect.RECT)
ComboBoxGadget( 3, 5, rect\bottom, 200, 120 )
Repeat : Until WaitWindowEvent() = #WM_CLOSE
EndIfNo programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
-
Edwin Knoppert
- Addict

- Posts: 1073
- Joined: Fri Apr 25, 2003 11:13 pm
- Location: Netherlands
- Contact:
