Archive for May, 2013

found the bug in TToolBar (Delphi6-XE4)

Tuesday, May 14th, 2013

Today I found the bug in CheckMenuDropdown method for standard TToolBar component. If you’ll assign to toolbar the mainmenu and one from item will have a lot of subitems (some are visible) then the position of dropdown menu will be incorrect (above of toolbar).
The reason of bug is the next code:

      if (GetSystemMetrics(SM_CYMENU) * FTempMenu.Items.Count) + APoint.Y >
         Screen.MonitorFromPoint(APoint).Height then
        Dec(APoint.Y, Button.Height);

As you see, the FTempMenu.Items.Count will return the counf of all subitems (including hidden).
The correct code:

      if (GetSystemMetrics(SM_CYMENU) * GetVisibleMenuItemCount()) + APoint.Y >
         Screen.MonitorFromPoint(APoint).Height then
        Dec(APoint.Y, Button.Height);

where GetVisibleMenuItemCount function is

  function GetVisibleMenuItemCount: Integer;
  var
    i: Integer;
  begin
    Result := 0;
    for i := 0 to FTempMenu.Items.Count-1 do
      if FTempMenu.Items[i].Visible then
        Inc(Result)
  end;

Unfortunatelly there is no way to override the CheckMenuDropdown method to fix this issue because all used variables (FTempMenu, FCaptureChangeCancels etc). So only one way is to patch the ComCtrls.pas unit.
This bug confirmed in all versions from Delphi 6 to XE4.

XE4 support

Friday, May 10th, 2013

Today the new trial and registered packages released to support the RAD Studio XE4 (Delphi and C++Builder). All out VCL component suites are supported.

The reg.user may send the request for update to [email protected]
Please include there any reg.information (order number, tracking id, password etc)