implemented TTICheckBox.PropertyNameAsCaption

git-svn-id: trunk@6580 -
This commit is contained in:
mattias 2005-01-13 23:22:02 +00:00
parent 952977c295
commit fe0efb9fa5
3 changed files with 26 additions and 12 deletions

View File

@ -9,7 +9,7 @@
<SaveOnlyProjectUnits Value="True"/> <SaveOnlyProjectUnits Value="True"/>
</Flags> </Flags>
<MainUnit Value="0"/> <MainUnit Value="0"/>
<ActiveEditorIndexAtStart Value="1"/> <ActiveEditorIndexAtStart Value="2"/>
<IconPath Value="./"/> <IconPath Value="./"/>
<TargetFileExt Value=""/> <TargetFileExt Value=""/>
<Title Value="exampleprojectgrid1"/> <Title Value="exampleprojectgrid1"/>
@ -19,7 +19,7 @@
<Filename Value="exampleprojectgrid1.lpr"/> <Filename Value="exampleprojectgrid1.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="ExampleProjectGrid1"/> <UnitName Value="ExampleProjectGrid1"/>
<UsageCount Value="22"/> <UsageCount Value="23"/>
</Unit0> </Unit0>
<Unit1> <Unit1>
<CursorPos X="18" Y="59"/> <CursorPos X="18" Y="59"/>
@ -31,7 +31,7 @@
<ResourceFilename Value="examplegrid1.lrs"/> <ResourceFilename Value="examplegrid1.lrs"/>
<TopLine Value="39"/> <TopLine Value="39"/>
<UnitName Value="ExampleGrid1"/> <UnitName Value="ExampleGrid1"/>
<UsageCount Value="22"/> <UsageCount Value="23"/>
</Unit1> </Unit1>
</Units> </Units>
<PublishOptions> <PublishOptions>

View File

@ -737,7 +737,9 @@ Type
FLink: TPropertyLink; FLink: TPropertyLink;
FLinkValueFalse: string; FLinkValueFalse: string;
FLinkValueTrue: string; FLinkValueTrue: string;
FPropertyNameAsCaption: boolean;
procedure SetLink(const AValue: TPropertyLink); procedure SetLink(const AValue: TPropertyLink);
procedure SetPropertyNameAsCaption(const AValue: boolean);
protected protected
procedure LinkLoadFromProperty(Sender: TObject); virtual; procedure LinkLoadFromProperty(Sender: TObject); virtual;
procedure LinkSaveToProperty(Sender: TObject); virtual; procedure LinkSaveToProperty(Sender: TObject); virtual;
@ -750,6 +752,8 @@ Type
property LinkValueTrue: string read FLinkValueTrue; property LinkValueTrue: string read FLinkValueTrue;
property LinkValueFalse: string read FLinkValueFalse; property LinkValueFalse: string read FLinkValueFalse;
property Link: TPropertyLink read FLink write SetLink; property Link: TPropertyLink read FLink write SetLink;
property PropertyNameAsCaption: boolean read FPropertyNameAsCaption
write SetPropertyNameAsCaption;
end; end;
@ -786,6 +790,7 @@ Type
property OnStartDrag; property OnStartDrag;
property ParentShowHint; property ParentShowHint;
property PopupMenu; property PopupMenu;
property PropertyNameAsCaption;
property ShowHint; property ShowHint;
property State; property State;
property TabOrder; property TabOrder;
@ -2309,11 +2314,21 @@ begin
FLink.Assign(AValue); FLink.Assign(AValue);
end; 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); procedure TTICustomCheckBox.LinkLoadFromProperty(Sender: TObject);
begin begin
if Sender=nil then ; if Sender=nil then ;
if (FLink.Editor=nil) then exit; if (FLink.Editor=nil) then exit;
Checked:=FLink.GetAsText<>FLinkValueFalse; Checked:=FLink.GetAsText<>FLinkValueFalse;
if FPropertyNameAsCaption then
Caption:=FLink.Editor.GetName;
end; end;
procedure TTICustomCheckBox.LinkSaveToProperty(Sender: TObject); procedure TTICustomCheckBox.LinkSaveToProperty(Sender: TObject);

View File

@ -589,14 +589,14 @@ end;
procedure TTICustomGrid.BeforeMoveSelection(const DCol, DRow: Integer); procedure TTICustomGrid.BeforeMoveSelection(const DCol, DRow: Integer);
begin begin
inherited BeforeMoveSelection(DCol, DRow); inherited BeforeMoveSelection(DCol, DRow);
if (FExtraBtnEditor<>nil)and(FExtraBtnEditor.Visible) then begin if (FExtraBtnEditor<>nil) and (FExtraBtnEditor.Visible) then begin
{$IFDEF DebugEditor} {$IFDEF DebugEditor}
DebugEditor('BeforeMoveSelection: ', FExtraBtnEditor); DebugEditor('BeforeMoveSelection: ', FExtraBtnEditor);
{$ENDIF} {$ENDIF}
EditorHiding := True; EditorHiding := True;
FExtraBtnEditor.Parent := nil;
UnlinkPropertyEditor(FExtraBtnEditor); UnlinkPropertyEditor(FExtraBtnEditor);
FExtraBtnEditor.Visible := false; FExtraBtnEditor.Visible := false;
FExtraBtnEditor.Parent := nil;
EditorHiding := false; EditorHiding := false;
end; end;
end; end;
@ -693,7 +693,7 @@ begin
PropName:=CurProp.PropName; PropName:=CurProp.PropName;
PropLink.SetObjectAndProperty(CurObject,PropName); PropLink.SetObjectAndProperty(CurObject,PropName);
end; end;
if FExtraBtnEditor<>nil then begin if (FExtraBtnEditor<>nil) then begin
PropLink:=GetPropertyLinkOfComponent(FExtraBtnEditor); PropLink:=GetPropertyLinkOfComponent(FExtraBtnEditor);
if PropLink<>nil then begin if PropLink<>nil then begin
CurObject:=GetTIObject(ObjectIndex); CurObject:=GetTIObject(ObjectIndex);
@ -775,6 +775,7 @@ begin
DebugEditor('doEditorHide', Editor); DebugEditor('doEditorHide', Editor);
{$ENDIF} {$ENDIF}
UnlinkPropertyEditor(Editor); UnlinkPropertyEditor(Editor);
UnlinkPropertyEditor(FExtraBtnEditor);
inherited DoEditorHide; inherited DoEditorHide;
end; end;
@ -808,11 +809,9 @@ procedure TTICustomGrid.UnlinkPropertyEditor(aEditor: TWinControl);
var var
PropLink: TCustomPropertyLink; PropLink: TCustomPropertyLink;
begin begin
if not (csDestroying in componentState) then begin PropLink:=GetPropertyLinkOfComponent(aEditor);
PropLink:=GetPropertyLinkOfComponent(aEditor); if PropLink<>nil then
if PropLink<>nil then PropLink.SetObjectAndProperty(nil,'');
PropLink.SetObjectAndProperty(nil,'');
end;
end; end;
constructor TTICustomGrid.Create(TheOwner: TComponent); constructor TTICustomGrid.Create(TheOwner: TComponent);
@ -1240,7 +1239,7 @@ end;
function TTIGridProperty.GetButtonEditorControl: TWinControl; function TTIGridProperty.GetButtonEditorControl: TWinControl;
begin begin
result := FButtonEditorControl; Result := FButtonEditorControl;
end; end;
function TTIGridProperty.PropName: string; function TTIGridProperty.PropName: string;