mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-10-29 15:17:16 +01:00
implemented showing property names for TTIGrid
git-svn-id: trunk@6520 -
This commit is contained in:
parent
487b6f09fc
commit
8f4126458f
@ -109,7 +109,7 @@ type
|
|||||||
FListObject: TObject;
|
FListObject: TObject;
|
||||||
FOnHeaderClick: THdrEvent;
|
FOnHeaderClick: THdrEvent;
|
||||||
FOnHeaderSized: THdrEvent;
|
FOnHeaderSized: THdrEvent;
|
||||||
FPropertyEditorHook: TPropertyEditorHook;
|
FHeaderPropHook: TPropertyEditorHook;
|
||||||
FSaveOnChangeTIObject: boolean;
|
FSaveOnChangeTIObject: boolean;
|
||||||
FTIStates: TTIGridStates;
|
FTIStates: TTIGridStates;
|
||||||
FTIObjectCount: integer;
|
FTIObjectCount: integer;
|
||||||
@ -154,7 +154,7 @@ type
|
|||||||
write FSaveOnChangeTIObject
|
write FSaveOnChangeTIObject
|
||||||
default true;
|
default true;
|
||||||
property Filter: TTypeKinds read FFilter write SetFilter default AllTypeKinds;
|
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 TIObjectCount: integer read FTIObjectCount;
|
||||||
property PropertyCount: integer read GetPropertyCount;
|
property PropertyCount: integer read GetPropertyCount;
|
||||||
property Properties[Index: integer]: TTIGridProperty read GetProperties;
|
property Properties[Index: integer]: TTIGridProperty read GetProperties;
|
||||||
@ -291,9 +291,9 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
// get header properties
|
// get header properties
|
||||||
FPropertyEditorHook.LookupRoot:=CurItem;
|
FHeaderPropHook.LookupRoot:=CurItem;
|
||||||
ClearProperties;
|
ClearProperties;
|
||||||
GetPersistentProperties(CurItem, FFilter, FPropertyEditorHook,
|
GetPersistentProperties(CurItem, FFilter, FHeaderPropHook,
|
||||||
@AddHeaderPropertyEditor,nil);
|
@AddHeaderPropertyEditor,nil);
|
||||||
PropCount:=PropertyCount;
|
PropCount:=PropertyCount;
|
||||||
if ListDirection=tldObjectsAsRows then begin
|
if ListDirection=tldObjectsAsRows then begin
|
||||||
@ -355,7 +355,7 @@ end;
|
|||||||
constructor TTICustomGrid.Create(TheOwner: TComponent);
|
constructor TTICustomGrid.Create(TheOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited Create(TheOwner);
|
inherited Create(TheOwner);
|
||||||
FPropertyEditorHook:=TPropertyEditorHook.Create;
|
FHeaderPropHook:=TPropertyEditorHook.Create;
|
||||||
FFilter:=[{tkUnknown,}tkInteger,tkChar,tkEnumeration,
|
FFilter:=[{tkUnknown,}tkInteger,tkChar,tkEnumeration,
|
||||||
tkFloat,{tkSet,tkMethod,}tkSString,tkLString,tkAString,
|
tkFloat,{tkSet,tkMethod,}tkSString,tkLString,tkAString,
|
||||||
tkWString,tkVariant,{tkArray,tkRecord,tkInterface,}
|
tkWString,tkVariant,{tkArray,tkRecord,tkInterface,}
|
||||||
@ -369,7 +369,7 @@ destructor TTICustomGrid.Destroy;
|
|||||||
begin
|
begin
|
||||||
ClearProperties;
|
ClearProperties;
|
||||||
FreeThenNil(FProperties);
|
FreeThenNil(FProperties);
|
||||||
FreeThenNil(FPropertyEditorHook);
|
FreeThenNil(FHeaderPropHook);
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -438,18 +438,26 @@ var
|
|||||||
PersistentList: TPersistentSelectionList;
|
PersistentList: TPersistentSelectionList;
|
||||||
ok: Boolean;
|
ok: Boolean;
|
||||||
CurObject: TPersistent;
|
CurObject: TPersistent;
|
||||||
|
IsHeader: Boolean;
|
||||||
begin
|
begin
|
||||||
PropEditor:=nil;
|
PropEditor:=nil;
|
||||||
IndependentEditor:=true;
|
IndependentEditor:=true;
|
||||||
if ListDirection=tldObjectsAsRows then begin
|
if ListDirection=tldObjectsAsRows then begin
|
||||||
ObjectIndex:=aRow-FixedRows;
|
ObjectIndex:=aRow-FixedRows;
|
||||||
PropertyIndex:=aCol-FixedCols;
|
PropertyIndex:=aCol-FixedCols;
|
||||||
|
IsHeader:=(aRow>=0) and (aRow<FixedRows);
|
||||||
end else begin
|
end else begin
|
||||||
ObjectIndex:=aCol-FixedCols;
|
ObjectIndex:=aCol-FixedCols;
|
||||||
PropertyIndex:=aRow-FixedRows;
|
PropertyIndex:=aRow-FixedRows;
|
||||||
|
IsHeader:=(aCol>=0) and (aCol<FixedCols);
|
||||||
end;
|
end;
|
||||||
if (PropertyIndex>=0) and (PropertyIndex<PropertyCount)
|
if (PropertyIndex>=0) and (PropertyIndex<PropertyCount) then begin
|
||||||
and (ObjectIndex>=0) and (ObjectIndex<TIObjectCount) then begin
|
GridProperty:=Properties[PropertyIndex];
|
||||||
|
if IsHeader then begin
|
||||||
|
IndependentEditor:=false;
|
||||||
|
PropEditor:=GridProperty.Editor;
|
||||||
|
end
|
||||||
|
else if (ObjectIndex>=0) and (ObjectIndex<TIObjectCount) then begin
|
||||||
CurObject:=GetTIObject(ObjectIndex);
|
CurObject:=GetTIObject(ObjectIndex);
|
||||||
if CurObject<>nil then begin
|
if CurObject<>nil then begin
|
||||||
ok:=false;
|
ok:=false;
|
||||||
@ -460,7 +468,6 @@ begin
|
|||||||
Hook.LookupRoot:=CurObject;
|
Hook.LookupRoot:=CurObject;
|
||||||
PersistentList:=TPersistentSelectionList.Create;
|
PersistentList:=TPersistentSelectionList.Create;
|
||||||
PersistentList.Add(CurObject);
|
PersistentList.Add(CurObject);
|
||||||
GridProperty:=Properties[PropertyIndex];
|
|
||||||
EditorClass:=TPropertyEditorClass(GridProperty.Editor.ClassType);
|
EditorClass:=TPropertyEditorClass(GridProperty.Editor.ClassType);
|
||||||
PropEditor:=EditorClass.Create(Hook,PersistentList,1);
|
PropEditor:=EditorClass.Create(Hook,PersistentList,1);
|
||||||
PropEditor.SetPropEntry(0,CurObject,GridProperty.PropInfo);
|
PropEditor.SetPropEntry(0,CurObject,GridProperty.PropInfo);
|
||||||
@ -485,6 +492,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TTICustomGrid.FreeCellEditor(PropEditor: TPropertyEditor);
|
procedure TTICustomGrid.FreeCellEditor(PropEditor: TPropertyEditor);
|
||||||
var
|
var
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user