Board index » delphi » Toolbars and docking

Toolbars and docking

Thanks for helping with these "beginner" questions:

1)  When I put a toolbar in a form and set it to Autosize, at runtime
the toolbar doesn't have a title bar with which to catch it easily for
dragging.  The titlebar only appears after I have dragged the toolbar.
How can I get the app to start with the toolbar having a titlebar ?

2)  The above toolbar can be docked on a ControlBar on the same form.
It works fine.
What if I want to initially start with the toolbar docked inside the
controlbar ?
If I design the toolbar inside the controlbar, the user can't drag it
out of there (it's considered to be a child of the controlbar, not the
form).
If I design the toolbar on the form, outside the controlbar, and drag it
"onto" the control bar at design time, it will just overlap the control
bar, and won't be docked inside when the program runs.
How do I start with the toolbar docked inside the controlbar?

3)  The toolbar buttons (the ones it generates itself) can be used as a
main menu, if the button property "menuitem" is linked with a menu.
However, it seems all toolbar buttons must have the same width!  So all
main menu items will have the same width. This looks a bit ugly since
some main menu captions are shorter than others.
How can set a different width to each toolbar button ?  (preferrably a
width that automatically sizes to the size of the caption).

Thanks for any help!

 

Re:Toolbars and docking


Quote
H. Debs wrote:
> Thanks for helping with these "beginner" questions:

> 1)  When I put a toolbar in a form and set it to Autosize, at runtime
> the toolbar doesn't have a title bar with which to catch it easily for
> dragging.  The titlebar only appears after I have dragged the toolbar.
> How can I get the app to start with the toolbar having a titlebar ?

> 2)  The above toolbar can be docked on a ControlBar on the same form.
> It works fine.
> What if I want to initially start with the toolbar docked inside the
> controlbar ?
> If I design the toolbar inside the controlbar, the user can't drag it
> out of there (it's considered to be a child of the controlbar, not the
> form).
> If I design the toolbar on the form, outside the controlbar, and drag it
> "onto" the control bar at design time, it will just overlap the control
> bar, and won't be docked inside when the program runs.
> How do I start with the toolbar docked inside the controlbar?

> 3)  The toolbar buttons (the ones it generates itself) can be used as a
> main menu, if the button property "menuitem" is linked with a menu.
> However, it seems all toolbar buttons must have the same width!  So all
> main menu items will have the same width. This looks a bit ugly since
> some main menu captions are shorter than others.
> How can set a different width to each toolbar button ?  (preferrably a
> width that automatically sizes to the size of the caption).

> Thanks for any help!

I've already found the solution to 2) and 3):

For 2):  I was wrong. When designing the toolbat inside the ControBar, the
toolbar
CAN be dragged out at run time.  (and it starts out docked).

For 3):  Individual toolbar buttons CAN have different widths if the
individual buttons'
AutoSize property is set.

However, I still don't have the answer to 1):  How can an app start up with
a floating toolbar that has a titlebar already at startup?

And here's another question:

4)  When implementing a Main Menu using a toolbar, the toolbar doesn't
really totally behave like a mainmenu.  In particular, if one menu item is
clicked, and the cursor is moved to another menu item, the new menu item is
not automatically selected and its submenu is not automatically shown.  (you
must actually click the second menu item).
Is there a way to have a toolbar behave like that?  (It has no "hot"
property)?
If not, any idea about the code necessary for implementing this?

Thanks.

Habib Debs

Re:Toolbars and docking


Quote
On Tue, 25 Aug 1998 20:39:01 +0200, "H. Debs" <hd...@compuserve.com> wrote:
>4)  When implementing a Main Menu using a toolbar, the toolbar doesn't
>really totally behave like a mainmenu.  In particular, if one menu item is
>clicked, and the cursor is moved to another menu item, the new menu item is
>not automatically selected and its submenu is not automatically shown.  (you
>must actually click the second menu item).
>Is there a way to have a toolbar behave like that?  (It has no "hot"
>property)?

Select all of the TToolButtons that are the main menu items and set the
Grouped property to TRUE.

Regards,
Brad Stowers
Delphi Free Stuff
http://www.pobox.com/~bstowers/delphi/

Re:Toolbars and docking


Hi All I have a problem with toolbuttons as well.
Short cuts for menus that belong to a popup menu
which belongs to a toolbutton do not work.

How do I get the short cuts to work?

jo...@tapsys.com.au

Re:Toolbars and docking


Thanks Brad... It works!  (I don't think this feature is documented in the help
file though!)

Here's another {*word*193} little issue:

When I drag a toolbar out of a controlbar, then I click on its titlebar
repeatedly, the floating toolbar moves with every click.  It has to do with what
is being selected when I click on the toolbar's title.  It seems that only the
toolbar itself is selected, instead of the whole little window containing toolbar
+ title.
This problem doesn't occur with Delphi's own toolbars.  When floating and you try
to drag them, the outline that appears covers the perimeter of the whole
toolbar+title window.  Only when you start getting into the controlbar does the
outline shrink to the size of the toolbar only.
In my case when I click on my floating toolbar, the drag outline is around the
toolbar only, and it repositions itself when the mouse button is released.

Any ideas?

Habib

Quote
Bradley D. Stowers wrote:
> Select all of the TToolButtons that are the main menu items and set the
> Grouped property to TRUE.

Other Threads