vcl-styles-utils icon indicating copy to clipboard operation
vcl-styles-utils copied to clipboard

bug in TVclStylesSystemMenu.CreateMenuStyles

Open mksjgj opened this issue 3 years ago • 0 comments

as the document suggestion, write this codes:

constructor TForm1.Create(AOwner: TComponent); begin

inherited;
TVclStylesSystemMenu.Create(Self);

end;

if you has compile option range check on(the default is false), you will get a runtime error:

Project Project1.exe raised exception class ERangeError with message 'Range check error'.

the reason is here:

if SameText('Windows', s) then
  AddMenuSeparatorHelper(FVCLStylesMenu, LSubMenuIndex);   //error: use a used LSubMenuIndex for new item

it should be:

if SameText('Windows', s) then
begin
  Inc(LSubMenuIndex); //n9p+: use a new index for the Separator
  AddMenuSeparatorHelper(FVCLStylesMenu, LSubMenuIndex);
end;

mksjgj avatar Aug 31 '22 09:08 mksjgj