Board index » cppbuilder » Menu Bar/Tool Bar/Cool Bar help/guidance

Menu Bar/Tool Bar/Cool Bar help/guidance

Hello all,
I've spent several hours trying to replicate the tool bar style seen in many
different applications. BCB is one. IE is another.

I am trying to create a primary menu bar that will offer the standard
commands; File, Edit, View, etc. These will be text labeled. I also want to
be able to dock a tool bar with icon based buttons.
What I can't figure out is how to get the primary menu bar created. I've
tried several different combinations of controls to create the same effect
that you see from BCB and IE. For those that haven't notices the effect,
I'll explain: It hot tracks on mouse over by creating a 3D outline around
the text label. You can resize the band that the text commands reside in. Of
course, when click on the command button, you get the menu.

I can create the menu with a popupmenu control. I can even create a band
that has text buttons. I can not create a band that has a flush appearance
until the mouse over. There are no separators between the commands. For that
matter, the icon toolbar has no button appearance until you mouse over them,

Does anyone have any suggestions? I've tried many different combinations of
controls and have created something similar, but not exactly what I want.

Thank you,



Re:Menu Bar/Tool Bar/Cool Bar help/guidance

If you're wanting your main menu as TToolbuttons in a TToolBar this is what
you need to do:

1).  Set up a TMainMenu with the menu structure you want, but make sure it
doesn't show at run time by making sure it is NOT assigned to the Menu
property of your form.

2).  Set up a TToolButton in the tool bar for each top level sub-menu in the
TMainMenu and set the Grouped property of each button to true.

3) Assign the MenuItem of each TToolButton to the appropriate sub-menu of
the TMainMenu.  When the button is pressed at run time, that sub-menu will
then drop down under the button.

Hope this helps

Re:Menu Bar/Tool Bar/Cool Bar help/guidance


Thank you.  I went back to experimenting this evening and found out the very
solution you've provided me with.

A little more information, in case you're interested in the exact feel I was
looking for:

Drop a TMainMenu on your form - confirming that it is NOT set as the
mainmenu for the form.
Drop a TCoolBar on your form.
Drop a TToolbar on your TCoolBar.
Assign the TToolBar AutoSize to TRUE.
Assign the TToolBar Flat property to TRUE.
Assign the TToolBar ShowCaptions property to TRUE.
Add TToolButtons to the TToolBar.
Assign the TToolButton MenuItem property to the desired value for each
Select all the TToolButtons, assign the Grouped and AllowAllUp properties to

Voila.  You now have the same look and feel that I was seeking.  This
replicates the look and feel of the dockable "main menu" toolbar.  I'm sure
that the icon based toolbar is quite similar to achieve with icons and such.
That's next on my agenda.

None-the-less, John, thank you for taking the time to offer aid.  Had I not
stopped to tinker more this evening, I wouldn't have finally stumbled on the
correct set of controls and properties to accomplish this.


Other Threads