Reapply image list fix for extra space besides top items in main menu, after form translation has taken place

This commit is contained in:
Ansgar Becker
2019-07-23 13:22:30 +02:00
parent db9e76bd78
commit 273be37469
3 changed files with 17 additions and 6 deletions

View File

@ -4,7 +4,7 @@ interface
uses
Classes, SysUtils, Forms, Windows, Messages, System.Types, StdCtrls, Clipbrd,
SizeGrip, apphelpers, Vcl.Graphics, Vcl.Dialogs, gnugettext;
SizeGrip, apphelpers, Vcl.Graphics, Vcl.Dialogs, gnugettext, Vcl.ImgList;
type
// Form with a sizegrip in the lower right corner, without the need for a statusbar
@ -32,11 +32,25 @@ implementation
{ TExtForm }
constructor TExtForm.Create(AOwner: TComponent);
var
OldImageList: TCustomImageList;
begin
inherited;
InheritFont(Font);
HasSizeGrip := False;
TranslateComponent(Self);
// Translation and related fixes
// Issue #557: Apply images *after* translating main menu, so top items don't get unused
// space left besides them.
if (Menu <> nil) and (Menu.Images <> nil) then begin
OldImageList := Menu.Images;
Menu.Images := nil;
TranslateComponent(Self);
Menu.Images := OldImageList;
end else begin
TranslateComponent(Self);
end;
end;