Board index » delphi » Second Post - Problems with TControlBars and TToolBars

Second Post - Problems with TControlBars and TToolBars

Hi,

I seem to be doing a lot of coding to get the ToolBars to do
simple things, so I'm beginning to think I've done something
dumb.

Changing the Font.Size will change ToolBars .ButtonHeight and
.ButtonWidth property values, but 'Buttons and 'Bars don't
resize, I have to toggle the a ToolButton's .AutoSize property
(already set True). I've tried 'Bar.Update and .Invalidate
methods at run-time, but without success; only the toggle will
do it.

The ControlBar can't seem to handle changes to ToolBars at run-
time. If ToolBars are one above the other, and one is resized,
then there's either a gap between them or one overlaps the other.
If the ToolBars are side by side and I extend one in code, the
other one closes up until only the sizing bar is visible:
however, then I can't seem to pull it open again.

Anyone got any suggestions or advice?

Regards,

Stuart

 

Re:Second Post - Problems with TControlBars and TToolBars


Maybe try calling UpdateControl for each button in the toolbar after
changing font.size at runtime?

Re:Second Post - Problems with TControlBars and TToolBars


Quote
Stuart wrote:

> Hi,

> I seem to be doing a lot of coding to get the ToolBars to do
> simple things, so I'm beginning to think I've done something
> dumb.

After some days of experimenting I have come to the conclusion
that both TControlBar and TCoolBar surface some serious glitches.

The ControlBar does not work anything near acceptable if you want
to resize the controls on the bands. Although in your case I see
hope: you may be able to do some band position fixing if you use
the 4 or 5 special controlbar events. OTOH I wanted to have two
bands with comboboxes and both boxes should be automatically re-
sized to fill all the space to the right border of the controlbar.
I managed to do that in code (after some trial and error and looking
into the VCL src) but then moving another band on top of this band
did not reduce the width of the enlarged band resulting in ugly
appearance, simply unusable.

The Coolbar is better with resizable bands. The problems are different
here: If you set FixedOrder to true the first band looses its sizing
grip (ok, that is only logical). But if you move the second band over
it you cannot move it away again (since the grip of the second band
is over the 'unmovable, invisible' grip of the first, I guess at least).
Or if you play with two bands, each with a combobox (edit control would
do as well probably), and position both in the same row, you will see
an animation: one box gets smaller the other bigger. No problem you say?
Well: this animation is very slow and flickers. And it "may" even occur
if you just move one band 'through' to another position and cross another
one which has a combo on it. You have to wait 1-2 seconds then until the
bands are done with their ugly and useless resize animation.

Sorry I digress. The point is however that you face some problems with
both bars and my research in VCL, events etc and this newsgroups did
not help. Live with it or drop them :( (I did the latter).

Regards,
WL

Re:Second Post - Problems with TControlBars and TToolBars


Hi Werner,

Thanks for this ... I was beginning to think it was just me ...

Regards,

Stuart

Quote
Werner Lehmann <w...@bwl.uni-kiel.de> wrote:

>After some days of experimenting I have come to the conclusion
>that both TControlBar and TCoolBar surface some serious glitches.

>Regards,
>WL

Re:Second Post - Problems with TControlBars and TToolBars


Hi Jason,

Thanks for replying. It's in the Help, I tried it, the compile
fell over, the method's in the VCL ... and it's protected! Aaa
                                                              g
                                                               h

Regards,

Stuart

Quote
"Jason Terando" <jasont_no_s...@rapidtext.com> wrote:
>Maybe try calling UpdateControl for each button in the toolbar after
>changing font.size at runtime?

Re:Second Post - Problems with TControlBars and TToolBars


In article <3a5f491b$1_2@dnews>, stu...@telmar.co.uk says...

Quote

> Hi Jason,

> Thanks for replying. It's in the Help, I tried it, the compile
> fell over, the method's in the VCL ... and it's protected! Aaa

Hi Stuart,

Did you know that you get at a protected method if you use a "cracker"
class? In this case you would declare the following:

type
  TToolButtonEx = class(TToolButton);

To access the protected method you would use it thus:

TToolButtonEx(ToolButton1).UpdateControl;

This works because Delphi scoping rules are such that you can access any
protected method or property of a class declared in the same unit as
your code.

Whether UpdateControl will solve your original problem, I don't know,
but it's a useful trick to know in any case.

Cheers,
Carl

Other Threads