LCL: TCustomEdit.SetCaretPos: do not call widgetset if no handle is allocated

git-svn-id: trunk@21803 -
This commit is contained in:
mattias 2009-09-21 12:49:07 +00:00
parent 47bdaddd85
commit fea2aafd1f
2 changed files with 8 additions and 2 deletions

View File

@ -35,6 +35,7 @@ begin
TWSCustomEditClass(WidgetSetClass).SetPasswordChar(Self, FPasswordChar);
TWSCustomEditClass(WidgetSetClass).SetReadOnly(Self, FReadOnly);
TWSCustomEditClass(WidgetSetClass).SetAlignment(Self, FAlignment);
TWSCustomEditClass(WidgetSetClass).SetCaretPos(Self, fCaretPos);
TWSCustomEditClass(WidgetSetClass).SetSelStart(Self, FSelStart);
TWSCustomEditClass(WidgetSetClass).SetSelLength(Self, FSelLength);
end;
@ -100,7 +101,9 @@ end;
------------------------------------------------------------------------------}
procedure TCustomEdit.SetCaretPos(const Value: TPoint);
begin
TWSCustomEditClass(WidgetSetClass).SetCaretPos(Self, Value);
fCaretPos:=Value;
if HandleAllocated then
TWSCustomEditClass(WidgetSetClass).SetCaretPos(Self, Value);
end;
{------------------------------------------------------------------------------
@ -511,7 +514,9 @@ end;
------------------------------------------------------------------------------}
function TCustomEdit.GetCaretPos: TPoint;
begin
Result := TWSCustomEditClass(WidgetSetClass).GetCaretPos(Self);
if HandleAllocated then
fCaretPos := TWSCustomEditClass(WidgetSetClass).GetCaretPos(Self);
Result:=fCaretPos;
end;
procedure TCustomEdit.SetAlignment(const AValue: TAlignment);

View File

@ -682,6 +682,7 @@ type
FAutoSelect: Boolean;
FAutoSelected: Boolean;
FCharCase: TEditCharCase;
fCaretPos: TPoint;
FEchoMode: TEchoMode;
FMaxLength: Integer;
FModified: Boolean;