From 8f4126458f0fd76f9bd978d2ff9fd5f42d88bbcf Mon Sep 17 00:00:00 2001 From: mattias Date: Sun, 9 Jan 2005 12:18:59 +0000 Subject: [PATCH] implemented showing property names for TTIGrid git-svn-id: trunk@6520 - --- components/rtticontrols/rttigrids.pas | 82 +++++++++++++++------------ 1 file changed, 45 insertions(+), 37 deletions(-) diff --git a/components/rtticontrols/rttigrids.pas b/components/rtticontrols/rttigrids.pas index d9dff6dcd1..856821d78b 100644 --- a/components/rtticontrols/rttigrids.pas +++ b/components/rtticontrols/rttigrids.pas @@ -109,7 +109,7 @@ type FListObject: TObject; FOnHeaderClick: THdrEvent; FOnHeaderSized: THdrEvent; - FPropertyEditorHook: TPropertyEditorHook; + FHeaderPropHook: TPropertyEditorHook; FSaveOnChangeTIObject: boolean; FTIStates: TTIGridStates; FTIObjectCount: integer; @@ -154,7 +154,7 @@ type write FSaveOnChangeTIObject default true; property Filter: TTypeKinds read FFilter write SetFilter default AllTypeKinds; - property PropertyEditorHook: TPropertyEditorHook read FPropertyEditorHook; + property PropertyEditorHook: TPropertyEditorHook read FHeaderPropHook; property TIObjectCount: integer read FTIObjectCount; property PropertyCount: integer read GetPropertyCount; property Properties[Index: integer]: TTIGridProperty read GetProperties; @@ -291,9 +291,9 @@ begin exit; end; // get header properties - FPropertyEditorHook.LookupRoot:=CurItem; + FHeaderPropHook.LookupRoot:=CurItem; ClearProperties; - GetPersistentProperties(CurItem, FFilter, FPropertyEditorHook, + GetPersistentProperties(CurItem, FFilter, FHeaderPropHook, @AddHeaderPropertyEditor,nil); PropCount:=PropertyCount; if ListDirection=tldObjectsAsRows then begin @@ -355,7 +355,7 @@ end; constructor TTICustomGrid.Create(TheOwner: TComponent); begin inherited Create(TheOwner); - FPropertyEditorHook:=TPropertyEditorHook.Create; + FHeaderPropHook:=TPropertyEditorHook.Create; FFilter:=[{tkUnknown,}tkInteger,tkChar,tkEnumeration, tkFloat,{tkSet,tkMethod,}tkSString,tkLString,tkAString, tkWString,tkVariant,{tkArray,tkRecord,tkInterface,} @@ -369,7 +369,7 @@ destructor TTICustomGrid.Destroy; begin ClearProperties; FreeThenNil(FProperties); - FreeThenNil(FPropertyEditorHook); + FreeThenNil(FHeaderPropHook); inherited Destroy; end; @@ -438,47 +438,55 @@ var PersistentList: TPersistentSelectionList; ok: Boolean; CurObject: TPersistent; + IsHeader: Boolean; begin PropEditor:=nil; IndependentEditor:=true; if ListDirection=tldObjectsAsRows then begin ObjectIndex:=aRow-FixedRows; PropertyIndex:=aCol-FixedCols; + IsHeader:=(aRow>=0) and (aRow=0) and (aCol=0) and (PropertyIndex=0) and (ObjectIndexnil then begin - ok:=false; - Hook:=nil; - PersistentList:=nil; - try - Hook:=TPropertyEditorHook.Create; - Hook.LookupRoot:=CurObject; - PersistentList:=TPersistentSelectionList.Create; - PersistentList.Add(CurObject); - GridProperty:=Properties[PropertyIndex]; - EditorClass:=TPropertyEditorClass(GridProperty.Editor.ClassType); - PropEditor:=EditorClass.Create(Hook,PersistentList,1); - PropEditor.SetPropEntry(0,CurObject,GridProperty.PropInfo); - PropEditor.Initialize; - ok:=true; - finally - if not ok then begin - try - PropEditor.free; - except - end; - try - PersistentList.free; - except - end; - try - Hook.free; - except + if (PropertyIndex>=0) and (PropertyIndex=0) and (ObjectIndexnil then begin + ok:=false; + Hook:=nil; + PersistentList:=nil; + try + Hook:=TPropertyEditorHook.Create; + Hook.LookupRoot:=CurObject; + PersistentList:=TPersistentSelectionList.Create; + PersistentList.Add(CurObject); + EditorClass:=TPropertyEditorClass(GridProperty.Editor.ClassType); + PropEditor:=EditorClass.Create(Hook,PersistentList,1); + PropEditor.SetPropEntry(0,CurObject,GridProperty.PropInfo); + PropEditor.Initialize; + ok:=true; + finally + if not ok then begin + try + PropEditor.free; + except + end; + try + PersistentList.free; + except + end; + try + Hook.free; + except + end; end; end; end;