fixed showing contents of TMemo, if it contained text in design mode (bug #1053)

git-svn-id: trunk@7690 -
This commit is contained in:
vincents 2005-09-13 20:45:00 +00:00
parent 787523db4d
commit defdd14239
5 changed files with 21 additions and 2 deletions

View File

@ -967,6 +967,7 @@ type
function GetAction: TBasicAction; virtual;
function RealGetText: TCaption; virtual;
procedure RealSetText(const Value: TCaption); virtual;
function GetCachedText(var CachedText: TCaption): boolean; virtual;
procedure SetAction(Value: TBasicAction); virtual;
procedure SetColor(Value: TColor); virtual;
procedure SetEnabled(Value: Boolean); virtual;

View File

@ -3175,6 +3175,12 @@ begin
Perform(CM_TEXTCHANGED, 0, 0);
end;
function TControl.GetCachedText(var CachedText: TCaption): boolean;
begin
CachedText := FCaption;
Result:= true;
end;
{------------------------------------------------------------------------------
TControl SetText
------------------------------------------------------------------------------}

View File

@ -143,6 +143,11 @@ begin
Lines.Text := Value;
end;
function TCustomMemo.GetCachedText(var CachedText: TCaption): boolean;
begin
Result:= false;
end;
{------------------------------------------------------------------------------
Method: TCustomMemo.SetLines
Params:

View File

@ -3953,6 +3953,8 @@ end;
created. Place cached property code here.
------------------------------------------------------------------------------}
procedure TWinControl.InitializeWnd;
var
CachedText: string;
begin
Assert(False, Format('Trace:[TWinControl.InitializeWnd] %s', [ClassName]));
// set all cached properties
@ -3978,7 +3980,8 @@ begin
// Delay the setting of text until it is completely loaded
if not (csLoading in ComponentState) then begin
TWSWinControlClass(WidgetSetClass).SetText(Self, FCaption);
if GetCachedText(CachedText) then
TWSWinControlClass(WidgetSetClass).SetText(Self, CachedText);
InvalidatePreferredSize;
end;
@ -4045,10 +4048,13 @@ end;
procedure TWinControl.Loaded;
------------------------------------------------------------------------------}
procedure TWinControl.Loaded;
var
CachedText: string;
begin
if HandleAllocated then begin
// Set cached caption
TWSWinControlClass(WidgetSetClass).SetText(Self, FCaption);
if GetCachedText(CachedText) then
TWSWinControlClass(WidgetSetClass).SetText(Self, CachedText);
InvalidatePreferredSize;
if [wcfColorChanged,wcfFontChanged]*FWinControlFlags<>[] then begin

View File

@ -668,6 +668,7 @@ type
procedure DestroyHandle; override;
function RealGetText: TCaption; override;
procedure RealSetText(const Value: TCaption); override;
function GetCachedText(var CachedText: TCaption): boolean; override;
procedure SetLines(const Value: TStrings);
procedure SetWordWrap(const Value: boolean);
procedure SetScrollBars(const Value: TScrollStyle);