From f99fce894306f37b41d9932421a82d3e85dfa039 Mon Sep 17 00:00:00 2001 From: marc Date: Tue, 20 Apr 2004 23:39:01 +0000 Subject: [PATCH] * Fixed setting of TWincontrol.Text during load git-svn-id: trunk@5418 - --- lcl/controls.pp | 4 +++- lcl/include/customlabel.inc | 5 ++++- lcl/include/wincontrol.inc | 34 ++++++++++++++++++++++++---------- 3 files changed, 31 insertions(+), 12 deletions(-) diff --git a/lcl/controls.pp b/lcl/controls.pp index d28d9e26b2..9179461d87 100644 --- a/lcl/controls.pp +++ b/lcl/controls.pp @@ -748,7 +748,6 @@ type FTabOrder: integer; FTabStop : Boolean; FTBDockHeight: Integer; - FText : TCaption; FTop: Integer; FUndockHeight: Integer; FUndockWidth: Integer; @@ -2261,6 +2260,9 @@ end. { ============================================================================= $Log$ + Revision 1.197 2004/04/20 23:39:01 marc + * Fixed setting of TWincontrol.Text during load + Revision 1.196 2004/04/18 23:55:39 marc * Applied patch from Ladislav Michl * Changed the way TControl.Text is resolved diff --git a/lcl/include/customlabel.inc b/lcl/include/customlabel.inc index caabf1a36f..c998ee6f62 100644 --- a/lcl/include/customlabel.inc +++ b/lcl/include/customlabel.inc @@ -43,7 +43,7 @@ end; ------------------------------------------------------------------------------} function TCustomLabel.GetLabelText: String; begin - Result := Caption; + Result := Caption; end; {------------------------------------------------------------------------------ @@ -185,6 +185,9 @@ end; { ============================================================================= $Log$ + Revision 1.15 2004/04/20 23:39:01 marc + * Fixed setting of TWincontrol.Text during load + Revision 1.14 2004/04/10 17:58:57 mattias implemented mainunit hints for include files diff --git a/lcl/include/wincontrol.inc b/lcl/include/wincontrol.inc index 9aa113dc7b..ea1085c377 100644 --- a/lcl/include/wincontrol.inc +++ b/lcl/include/wincontrol.inc @@ -2083,7 +2083,7 @@ begin FillChar(Params, SizeOf(Params),0); with Params do begin - Caption := @FText; + Caption := @FCaption; Style := WS_CHILD or WS_CLIPSIBLINGS; if (Parent <> nil) then WndParent := Parent.Handle; end; @@ -3061,7 +3061,7 @@ begin Assert(False, Format('Trace:[TWinControl.InitializeWnd] %s', [ClassName])); // set all cached properties -//writeln('[TWinControl.InitializeWnd] ',Name,':',ClassName,' ',Left,',',Top,',',Width,',',Height); + //writeln('[TWinControl.InitializeWnd] ',Name,':',ClassName,':', FCaption,' ',Left,',',Top,',',Width,',',Height); DoSendBoundsToInterface; CNSendMessage(LM_SHOWHIDE, Self, nil); @@ -3073,8 +3073,10 @@ begin end; EnableWindow(Handle, Enabled); - - RealSetText(FCaption); + + // Delay the setting of text until it is complete loaded + if not (csLoading in ComponentState) + then TWSWinControlClass(WidgetSetClass).SetText(Self, FCaption); SetProp(Handle,'WinControl',TWinControl(Self)); SetProp(Handle,'Control',TControl(Self)); @@ -3116,12 +3118,20 @@ begin inherited Loaded; RealizeBounds; FixupTabList; - if ([wcfColorChanged,wcfFontChanged]*FFlags<>[]) and HandleAllocated then - begin - // ToDo: replace by update style call - CNSendMessage(LM_SETCOLOR, Self, nil); - FFlags:=FFlags-[wcfColorChanged,wcfFontChanged]; + + if HandleAllocated + then begin + // Set cached caption + TWSWinControlClass(WidgetSetClass).SetText(Self, FCaption); + + if [wcfColorChanged,wcfFontChanged]*FFlags<>[] then + begin + // ToDo: replace by update style call + CNSendMessage(LM_SETCOLOR, Self, nil); + FFlags:=FFlags-[wcfColorChanged,wcfFontChanged]; + end; end; + // align the childs if wcfReAlignNeeded in FFlags then ReAlign; @@ -3342,7 +3352,8 @@ end; ------------------------------------------------------------------------------} procedure TWinControl.RealSetText(const Value: TCaption); begin - if HandleAllocated and (not (csLoading in ComponentState)) + if HandleAllocated + and (not (csLoading in ComponentState)) then TWSWinControlClass(WidgetSetClass).SetText(Self, Value); inherited; end; @@ -3460,6 +3471,9 @@ end; { ============================================================================= $Log$ + Revision 1.220 2004/04/20 23:39:01 marc + * Fixed setting of TWincontrol.Text during load + Revision 1.219 2004/04/18 23:55:39 marc * Applied patch from Ladislav Michl * Changed the way TControl.Text is resolved