RRUZ / vcl-styles-utils

Extend and improve the Delphi VCL Styles
https://theroadtodelphi.wordpress.com/
329 stars 115 forks source link

bug in TVclStylesSystemMenu.CreateMenuStyles #299

Open mksjgj opened 2 years ago

mksjgj commented 2 years ago

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;