Board index » cppbuilder » How to make ToolBar with ToolButtons having same width and showing their Captions

How to make ToolBar with ToolButtons having same width and showing their Captions

Hi all!

Tell me how can I make ToolBar having some (for example 10) ToolButtons.

I want to do this so that:

1) all ToolButtons must show text on their surface:
    ToolButton1->Caption = "F1 Help";
    ToolButton2->Caption = "F2 Save";

2) all ToolButtons have same width and adjust their width accordingly
MainForm->ClientWidth, a sort of:

 ToolBar1->ButtonWidth = MainForm->ClientWidth  / 10;

3) when width of MainForm became too small, text on the ToolButtons must be
cutted.

When I set

    ToolBar->ShowCaptions to 'false'

and OnResize event of MainForm to:

     ToolBar1->ButtonWidth = MainForm->ClientWidth  / 10;

it works just fine but Captions are naturally invisible.

The problem is when I set ToolBar->ShowCaptions to 'true', ToolButton->Width
adjusts accordingly the width of ToolButton->Caption width (in pixels), and
I can't change ToolBar1->ButtonWidth property runtime and desightime.

Thanks in advance.

Yuri.

 

Re:How to make ToolBar with ToolButtons having same width and showing their Captions


There must be property in TToolBar that enables showing captions.

"Yuri" <sta...@hotbox.ru> iletide yazdy news:3b682827_2@dnews...

Quote
> Hi all!

> Tell me how can I make ToolBar having some (for example 10) ToolButtons.

> I want to do this so that:

> 1) all ToolButtons must show text on their surface:
>     ToolButton1->Caption = "F1 Help";
>     ToolButton2->Caption = "F2 Save";

> 2) all ToolButtons have same width and adjust their width accordingly
> MainForm->ClientWidth, a sort of:

>  ToolBar1->ButtonWidth = MainForm->ClientWidth  / 10;

> 3) when width of MainForm became too small, text on the ToolButtons must
be
> cutted.

> When I set

>     ToolBar->ShowCaptions to 'false'

> and OnResize event of MainForm to:

>      ToolBar1->ButtonWidth = MainForm->ClientWidth  / 10;

> it works just fine but Captions are naturally invisible.

> The problem is when I set ToolBar->ShowCaptions to 'true',
ToolButton->Width
> adjusts accordingly the width of ToolButton->Caption width (in pixels),
and
> I can't change ToolBar1->ButtonWidth property runtime and desightime.

> Thanks in advance.

> Yuri.

Other Threads