Control in Toolbar

Started by Rolf Brandt, February 02, 2010, 09:05:16 AM

Previous topic - Next topic

Rolf Brandt

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?
Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

José Roca

Better make room for it between two separators, then create the label and make it children of the toolbar using the API function SetParent.

Rolf Brandt

#2
Thanks Jose!

But where in FF3 would I find the HWnd for the toolbar?
Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

Paul Squires

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)




Paul Squires
PlanetSquires Software

Rolf Brandt

Great! Thanks for the quick help, Paul.
Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

Rolf Brandt

Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

Rolf Brandt

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?
Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)