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"/>
</Flags>
<MainUnit Value="0"/>
<ActiveEditorIndexAtStart Value="1"/>
<ActiveEditorIndexAtStart Value="2"/>
<IconPath Value="./"/>
<TargetFileExt Value=""/>
<Title Value="exampleprojectgrid1"/>
@ -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>

View File

@ -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);

View File

@ -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;