lcl: fix TLabel autosize when ShowAccelChars = False and label contains ampersands (based on patch of Bart) (bug #0015731)

git-svn-id: trunk@24944 -
This commit is contained in:
paul 2010-04-26 02:45:38 +00:00
parent 4cf5a87f9d
commit a47badd924
2 changed files with 6 additions and 14 deletions

View File

@ -60,6 +60,9 @@ begin
if not HasMultiLine then
Flags := Flags or DT_SINGLELINE;
if not ShowAccelChar then
Flags := Flags or DT_NOPREFIX;
LabelText := GetLabelText;
DrawText(DC, PChar(LabelText), Length(LabelText), R, Flags);
SelectObject(DC, OldFont);
@ -168,11 +171,6 @@ begin
FFocusControl.SetFocus;
end;
function TCustomLabel.GetAlignment : TAlignment;
begin
Result := FAlignment;
end;
function TCustomLabel.GetLabelText: string;
begin
Result := Caption;
@ -184,6 +182,7 @@ begin
begin
FShowAccelChar := Value;
Invalidate;
UpdateSize;
end;
end;
@ -207,11 +206,6 @@ begin
end;
end;
function TCustomLabel.GetShowAccelChar : Boolean;
begin
Result := FShowAccelChar;
end;
function TCustomLabel.CanTab: boolean;
begin
Result := False;

View File

@ -1398,8 +1398,6 @@ type
procedure WMActivate(var Message: TLMActivate); message LM_ACTIVATE;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
function GetShowAccelChar: Boolean;
function GetAlignment: TAlignment;
function GetLabelText: string; virtual;
function GetTransparent: boolean;
procedure SetColor(NewColor: TColor); override;
@ -1411,10 +1409,10 @@ type
procedure Loaded; override;
procedure UpdateSize;
property Alignment: TAlignment read GetAlignment write SetAlignment default taLeftJustify;
property Alignment: TAlignment read FAlignment write SetAlignment default taLeftJustify;
property FocusControl: TWinControl read FFocusControl write SetFocusControl;
property Layout: TTextLayout read FLayout write SetLayout default tlTop;
property ShowAccelChar: Boolean read GetShowAccelChar write SetShowAccelChar default true;
property ShowAccelChar: Boolean read FShowAccelChar write SetShowAccelChar default true;
property Transparent: boolean read GetTransparent write SetTransparent default true;
property WordWrap: Boolean read FWordWrap write SetWordWrap default false;
property OptimalFill: Boolean read FOptimalFill write SetOptimalFill default false;