diff --git a/components/rtticontrols/examples/exampleprojectgrid1.lpi b/components/rtticontrols/examples/exampleprojectgrid1.lpi index 5adf03bb2f..0a36623942 100644 --- a/components/rtticontrols/examples/exampleprojectgrid1.lpi +++ b/components/rtticontrols/examples/exampleprojectgrid1.lpi @@ -9,7 +9,7 @@ - + @@ -19,7 +19,7 @@ <Filename Value="exampleprojectgrid1.lpr"/> <IsPartOfProject Value="True"/> <UnitName Value="ExampleProjectGrid1"/> - <UsageCount Value="22"/> + <UsageCount Value="23"/> </Unit0> <Unit1> <CursorPos X="18" Y="59"/> @@ -31,7 +31,7 @@ <ResourceFilename Value="examplegrid1.lrs"/> <TopLine Value="39"/> <UnitName Value="ExampleGrid1"/> - <UsageCount Value="22"/> + <UsageCount Value="23"/> </Unit1> </Units> <PublishOptions> diff --git a/components/rtticontrols/rttictrls.pas b/components/rtticontrols/rttictrls.pas index 588e7ad265..0e49038559 100644 --- a/components/rtticontrols/rttictrls.pas +++ b/components/rtticontrols/rttictrls.pas @@ -737,7 +737,9 @@ Type FLink: TPropertyLink; FLinkValueFalse: string; FLinkValueTrue: string; + FPropertyNameAsCaption: boolean; procedure SetLink(const AValue: TPropertyLink); + procedure SetPropertyNameAsCaption(const AValue: boolean); protected procedure LinkLoadFromProperty(Sender: TObject); virtual; procedure LinkSaveToProperty(Sender: TObject); virtual; @@ -750,6 +752,8 @@ Type property LinkValueTrue: string read FLinkValueTrue; property LinkValueFalse: string read FLinkValueFalse; property Link: TPropertyLink read FLink write SetLink; + property PropertyNameAsCaption: boolean read FPropertyNameAsCaption + write SetPropertyNameAsCaption; end; @@ -786,6 +790,7 @@ Type property OnStartDrag; property ParentShowHint; property PopupMenu; + property PropertyNameAsCaption; property ShowHint; property State; property TabOrder; @@ -2309,11 +2314,21 @@ begin FLink.Assign(AValue); end; +procedure TTICustomCheckBox.SetPropertyNameAsCaption(const AValue: boolean); +begin + if FPropertyNameAsCaption=AValue then exit; + FPropertyNameAsCaption:=AValue; + if FPropertyNameAsCaption and (FLink.Editor<>nil) then + Caption:=FLink.Editor.GetName; +end; + procedure TTICustomCheckBox.LinkLoadFromProperty(Sender: TObject); begin if Sender=nil then ; if (FLink.Editor=nil) then exit; Checked:=FLink.GetAsText<>FLinkValueFalse; + if FPropertyNameAsCaption then + Caption:=FLink.Editor.GetName; end; procedure TTICustomCheckBox.LinkSaveToProperty(Sender: TObject); diff --git a/components/rtticontrols/rttigrids.pas b/components/rtticontrols/rttigrids.pas index b639ae2845..4da8994324 100644 --- a/components/rtticontrols/rttigrids.pas +++ b/components/rtticontrols/rttigrids.pas @@ -589,14 +589,14 @@ end; procedure TTICustomGrid.BeforeMoveSelection(const DCol, DRow: Integer); begin inherited BeforeMoveSelection(DCol, DRow); - if (FExtraBtnEditor<>nil)and(FExtraBtnEditor.Visible) then begin + if (FExtraBtnEditor<>nil) and (FExtraBtnEditor.Visible) then begin {$IFDEF DebugEditor} DebugEditor('BeforeMoveSelection: ', FExtraBtnEditor); {$ENDIF} EditorHiding := True; + FExtraBtnEditor.Parent := nil; UnlinkPropertyEditor(FExtraBtnEditor); FExtraBtnEditor.Visible := false; - FExtraBtnEditor.Parent := nil; EditorHiding := false; end; end; @@ -693,7 +693,7 @@ begin PropName:=CurProp.PropName; PropLink.SetObjectAndProperty(CurObject,PropName); end; - if FExtraBtnEditor<>nil then begin + if (FExtraBtnEditor<>nil) then begin PropLink:=GetPropertyLinkOfComponent(FExtraBtnEditor); if PropLink<>nil then begin CurObject:=GetTIObject(ObjectIndex); @@ -775,6 +775,7 @@ begin DebugEditor('doEditorHide', Editor); {$ENDIF} UnlinkPropertyEditor(Editor); + UnlinkPropertyEditor(FExtraBtnEditor); inherited DoEditorHide; end; @@ -808,11 +809,9 @@ procedure TTICustomGrid.UnlinkPropertyEditor(aEditor: TWinControl); var PropLink: TCustomPropertyLink; begin - if not (csDestroying in componentState) then begin - PropLink:=GetPropertyLinkOfComponent(aEditor); - if PropLink<>nil then - PropLink.SetObjectAndProperty(nil,''); - end; + PropLink:=GetPropertyLinkOfComponent(aEditor); + if PropLink<>nil then + PropLink.SetObjectAndProperty(nil,''); end; constructor TTICustomGrid.Create(TheOwner: TComponent); @@ -1240,7 +1239,7 @@ end; function TTIGridProperty.GetButtonEditorControl: TWinControl; begin - result := FButtonEditorControl; + Result := FButtonEditorControl; end; function TTIGridProperty.PropName: string;