MG: fixed handle allocating in TLabel

git-svn-id: trunk@3518 -
This commit is contained in:
lazarus 2002-10-16 17:06:33 +00:00
parent 60666f3f8f
commit 85b9ae6942

View File

@ -43,13 +43,14 @@ end;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function TCustomLabel.GetLabelText: String; function TCustomLabel.GetLabelText: String;
begin begin
GetLabelText:= Caption; Result := Caption;
end; end;
procedure TCustomLabel.Notification(AComponent : TComponent; Operation : TOperation); procedure TCustomLabel.Notification(AComponent : TComponent; Operation : TOperation);
begin begin
inherited Notification(AComponent, Operation); inherited Notification(AComponent, Operation);
if (AComponent = FFocusControl) and (Operation = opRemove) then FFocusControl:= nil; if (AComponent = FFocusControl) and (Operation = opRemove) then
FFocusControl:= nil;
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
@ -62,11 +63,12 @@ procedure TCustomLabel.SetAlignment(Value : TAlignment);
begin begin
if fAlignment <> value then begin if fAlignment <> value then begin
fAlignment:= value; fAlignment:= value;
HandleNeeded; if HandleAllocated then begin
Invalidate; Invalidate;
CNSendMessage(LM_SETPROPERTIES, Self, nil); CNSendMessage(LM_SETPROPERTIES, Self, nil);
end; end;
end; end;
end;
Procedure TCustomLabel.DoAutoSize; Procedure TCustomLabel.DoAutoSize;
var var
@ -114,6 +116,7 @@ procedure TCustomLabel.SetLayout(Value : TTextLayout);
begin begin
if FLayout <> Value then begin if FLayout <> Value then begin
FLayout:= Value; FLayout:= Value;
if HandleAllocated then
CNSendMessage(LM_SETPROPERTIES, Self, nil); CNSendMessage(LM_SETPROPERTIES, Self, nil);
end; end;
end; end;
@ -142,11 +145,12 @@ procedure TCustomLabel.SetWordWrap(Value : Boolean);
begin begin
if fWordWrap <> value then begin if fWordWrap <> value then begin
fWordWrap:= value; fWordWrap:= value;
HandleNeeded; if HandleAllocated then begin
Invalidate; Invalidate;
CNSendMessage(LM_SETPROPERTIES, Self, nil); CNSendMessage(LM_SETPROPERTIES, Self, nil);
end; end;
end; end;
end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
Method: TCustomLabel.WMActivate Method: TCustomLabel.WMActivate
@ -166,6 +170,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.8 2002/10/16 17:06:33 lazarus
MG: fixed handle allocating in TLabel
Revision 1.7 2002/10/03 00:08:50 lazarus Revision 1.7 2002/10/03 00:08:50 lazarus
AJ: TCustomLabel Autosize, TCustomCheckbox '&' shortcuts started AJ: TCustomLabel Autosize, TCustomCheckbox '&' shortcuts started