PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Rolf Brandt on February 02, 2010, 09:05:16 AM

Title: Control in Toolbar
Post by: Rolf Brandt on February 02, 2010, 09:05:16 AM
I have a form with a toolbar at the top. Since there is ample space to the right side I would like to place a clock control (a label that shows the time) in that area.

Two scenarios come to my mind:
- Limit the width of the toolbar.
- Position a label on top of the toolbar.

Would something like that be possible?
Title: Re: Control in Toolbar
Post by: José Roca on February 03, 2010, 02:26:52 AM
Better make room for it between two separators, then create the label and make it children of the toolbar using the API function SetParent.
Title: Re: Control in Toolbar
Post by: Rolf Brandt on February 03, 2010, 03:55:43 AM
Thanks Jose!

But where in FF3 would I find the HWnd for the toolbar?
Title: Re: Control in Toolbar
Post by: Paul Squires on February 03, 2010, 08:53:07 AM
Depends on whether the toolbar is a child of a rebar or if it is just a standalone toolbar.

If part of a rebar......


Local hRebar As Dword
Local hToolBar As Dword

hRebar = GetDlgItem( hWndForm, IDC_FRMMAIN_REBAR )
hToolBar = GetDlgItem( hRebar, IDC_FRMMAIN_TOOLBAR1 )



If standalone......


Local hToolBar As Dword

hToolBar = GetDlgItem( hWndForm, IDC_FRMMAIN_TOOLBAR1 )


(Substitute your IDC_'s depending on the name you have given your form/rebar/toolbar)




Title: Re: Control in Toolbar
Post by: Rolf Brandt on February 03, 2010, 08:57:18 AM
Great! Thanks for the quick help, Paul.
Title: Re: Control in Toolbar
Post by: Rolf Brandt on February 03, 2010, 09:03:47 AM
... and it works perfect!
Title: Re: Control in Toolbar
Post by: Rolf Brandt on February 03, 2010, 09:14:27 AM
What I did notice though is that the control changes its ForeColor and Backcolor. Is it possible to change that? Or does the toolbar set that?