Watch, Follow, &
Connect with Us

Please visit our new home

Public Report
Report From: Delphi-BCB/VCL/Win 32 Controls/TCoolBar    [ Add a report in this area ]  
Report #:  70868   Status: Open
Ever-growing coolbands in TCoolbar
Project:  Delphi Build #:  2009, ... XE2
Version:    16.4 Submitted By:   Simon Moscrop
Report Type:  Basic functionality failure Date Reported:  1/26/2009 2:53:18 AM
Severity:    Serious / Highly visible problem Last Updated: 7/30/2012 3:20:31 AM
Platform:    All versions Internal Tracking #:   30457
Resolution: None (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: (1 Total Rating)
4.00 out of 5
Total Votes: 1
In an application containing 2 or more coolbands within a TCoolbar component* the leftmost coolband always grows in size when the form is resized horizontally.

In such a configuration if the form is resized horizontally to make the form wider the left hand coolbar grows in size. If the form is resized horizontally to make the form narrower the left hand coolbar also grows in size. This results in an ever expanding toolbar.

In a simliar application produced using Delphi 7 this problem does not exist. (both tests I ran using windows Vista as the client machine)

*(e.g. when using a TCoolband to contain multiple TToolbar intances)
Steps to Reproduce:
Added by Sysop
In a project with 2 ToolBar placed on a Coolbar when the 2 Toolbar are placed on a single row the left toolbar grow in width when the form is resized.
I attach here the simple project generated with Delphi XE2.
Also, as in the project the Autosize of the Coolbar is not set to true the coolbar is not paint properly after the resize.
The problem is solved with the solution given (submitted by Ludek) in the report but force to patch the VCL.
The problem is not seen if the ComCtlVersion is different from ComCtlVersionIE610.

1. Create a win32 app.
2. Drop a TCoolbar on the form
3. Within this TCoolbar create 2 Coolbands
4. Assign a TPanel to each coolband and  set the 'Break' property to false for each of the coolbands.
5. Run the application... First resize the form to make it wider and observe the resizing of the coolbands then resize the form to make it narrower and again observe the resizing of the coolbands.

Simon Moscrop at 1/26/2009 2:57:02 AM -
Sorry I had some kind of error when using the web client for quality central and have not been able to upload my demo application. This only takes a few seconds to reconstruct anyhow.

Markus Humm at 1/26/2009 11:26:01 AM -
You can add your attachment with one of the Windows clients, e.g. the one already included under Delphi/Tools menu in newer Delphi versions.

Ludek Stauber at 10/1/2010 5:36:43 AM -
edit comctrls.pas and change following method

{ Return height/width (depending on Vertical property) of coolbar grip area }
function TCoolBar.GetCaptionSize(Band: TCoolBand): Integer;
  Text: string;
  Adjust, DesignText: Boolean;
  Result := 0;
  Adjust := False;
  if (Band <> nil) and ((csDesigning in ComponentState) or Band.Visible) then
    DesignText := (csDesigning in ComponentState) and
      (Band.Control = nil) and (Band.Text = '');
    if ShowText or DesignText then
      if DesignText then
        Text := Band.DisplayName
        Text := Band.Text;
      if Text <> '' then
        Adjust := True;
        if Vertical then
          Result := FCaptionFontHeight
          with TControlCanvas.Create do
            Control := Self;
            Font := FCaptionFont;
            Result := TextWidth(Text)
    if Band.ImageIndex >= 0 then
      if Adjust then Inc(Result, 2);
      if FImages <> nil then
        Adjust := True;
        if Vertical then
          Inc(Result, FImages.Height)
          Inc(Result, FImages.Width)
      else if not Adjust then
        Inc(Result, ControlMargin);
    if Adjust then Inc(Result, ControlMargin);
    if (not FixedOrder or (Band.FID and IDMask > 0)) and not Band.FixedSize then
      Inc(Result, ControlMargin);
      { The grip size in IE4 is 3 pixels narrower than IE3 }
      if GetComCtlVersion < ComCtlVersionIE4 then
        Inc(Result, GripSizeIE3)
// ---------- add following lines - beginning
      else if GetComCtlVersion >= ComCtlVersionIE610 then
        Inc(Result, GripSizeIE610)
// ---------- add following lines - end
      Inc(Result, GripSizeIE4);

and 2 new consts:
  ComCtlVersionIE610 = $0006000A;
  GripSizeIE610 = 4;

the coolbar component should be rewritten from the scratch and not depend on such values, which microsoft changes each windows version...

Ludek Stauber at 10/4/2010 12:59:51 AM -
You can see the problem even directly in delphi. start delphi on w7 or vista (not switched to w2000-look, just installation defaults), make new vcl application, ensure, that in project options is theme support enabled, place tcoolbar on the form, create 2 bands with tpanel, rearrange bands, so that both are in one line.
Ensure, you really see the new vista & w7 coolbar layout - many small 3d points in the band sizing grip.
now start vertically resizing the coolbar. left coolband grows and grows, graphics in the resized area is getting corrupted etc. etc.

Michele Ribaudo at 7/17/2012 3:46:44 AM -
I came here having the same problem. Why this is not yet fixed in XE2?
The problem can be seen only if the toolbar inside the coolbar have the align property set to alTop (default).
The two rows of code and const from Ludek solve the problem but force to patch the VCL.

Tomohiro Takahashi at 7/17/2012 5:44:36 PM -
Do you have any sample project to reproduce/confirm your issue?
If yes, could you please upload it(as a .zip) to Discussion Forum?
[Embarcadero Discussion Forums >> Attachments]

Michele Ribaudo at 7/28/2012 3:14:18 AM -
Hi Tomohiro,
I have posted the project here

Tomohiro Takahashi at 7/30/2012 5:53:27 PM -
This report was opened with valid Internal Tracking Number.

Henrik R. Carlsen at 9/3/2015 3:13:12 AM -
Some progress on this one would be nice!

Server Response from: ETNACODE01