Class TrDBTreeView

Unit

Declaration

type TrDBTreeView = class(TTreeView)

Description

database version of standard TTreeView component which provides function for loading datasets values to tree structure.

Hierarchy

  • TTreeView
  • TrDBTreeView

Overview

Methods

Public constructor Create(AOwner: TComponent); override;
Public procedure EndUpdate; virtual;
Public procedure DragDrop(Source: TObject; X, Y: integer); override;
Public function GetSelectedData: TNodeObject;
Public function GetNodeData(NodeAbsoluteIndex: integer): TNodeObject;
Public procedure ProcessAllItems(UseChanged, UseMoved: boolean; CallBackProc: TTVChangedEvent; ResetState: boolean);
Public function FindNode(KeyField: TField; KeyValue: variant): TTreeNode;
Public procedure RefreshData(Delayed: boolean = false; KeepSelectedNode: boolean = false);
Public procedure RefreshNode(Node: TTreeNode);
Public procedure CreateChildNodes(ParentNode: TTreeNode; MultilevelNode, RemoveCurrentNodes: boolean);
Public procedure CreateSiblingNode(SiblingNode: TTreeNode);

Properties

Published property MasterDataSource: TDataSource read GetMasterDataSource write SetMasterDataSource;
Published property DataItemDefs: TDataItemDefs read FDataItemDefs write SetDataItemDefs;
Published property DataItemDesignTime: boolean read FDataItemDesignTime write SetDataItemDesignTime default true;
Published property LoadFirstLevelOnly: boolean read FLoadFirstLevelOnly write FLoadFirstLevelOnly default false;
Published property OnItemEdited: TTVChangedEvent read FOnItemEdited write FOnItemEdited;
Published property OnItemMoved: TTVChangedEvent read FOnItemMoved write FOnItemMoved;
Published property OnItemObjectDefined: TTVItemObjectDefinedEvent read FOnItemObjectDefined write FOnItemObjectDefined;
Published property LoadDataDelay: cardinal read FLoadDataDelay write FLoadDataDelay default 0;

Description

Methods

Public constructor Create(AOwner: TComponent); override;
 
Public procedure EndUpdate; virtual;
 
Public procedure DragDrop(Source: TObject; X, Y: integer); override;
 
Public function GetSelectedData: TNodeObject;

return datastructure for selected node, Node.Data can be used too

Public function GetNodeData(NodeAbsoluteIndex: integer): TNodeObject;

return datastructure for node according index, use AbsoluteIndex to get Node index

Public procedure ProcessAllItems(UseChanged, UseMoved: boolean; CallBackProc: TTVChangedEvent; ResetState: boolean);

go through all items and call CallBackProc for each changed or moved item

Public function FindNode(KeyField: TField; KeyValue: variant): TTreeNode;

try to find node according KeyField and value

Public procedure RefreshData(Delayed: boolean = false; KeepSelectedNode: boolean = false);

reload all nodes

Public procedure RefreshNode(Node: TTreeNode);

reload text of node, it uses current record, so dataset must be moved to correct record before calling

Public procedure CreateChildNodes(ParentNode: TTreeNode; MultilevelNode, RemoveCurrentNodes: boolean);

create child nodes, it uses current dataset records, so number of items is defined by dataset

Public procedure CreateSiblingNode(SiblingNode: TTreeNode);

create child nodes, it uses current dataset records, so number of items is defined by dataset

Properties

Published property MasterDataSource: TDataSource read GetMasterDataSource write SetMasterDataSource;

define datasource used for automatic loading of data

Published property DataItemDefs: TDataItemDefs read FDataItemDefs write SetDataItemDefs;

define collection of DataItemDefinition

Published property DataItemDesignTime: boolean read FDataItemDesignTime write SetDataItemDesignTime default true;

define whether data items is shown in design time and stored to DFM as items

Published property LoadFirstLevelOnly: boolean read FLoadFirstLevelOnly write FLoadFirstLevelOnly default false;

define whether only first level of items is loaded and child data is loaded after expand of item

Published property OnItemEdited: TTVChangedEvent read FOnItemEdited write FOnItemEdited;

event is called after edit text of item

Published property OnItemMoved: TTVChangedEvent read FOnItemMoved write FOnItemMoved;

event is called after drag-and-drop for moved item

Published property OnItemObjectDefined: TTVItemObjectDefinedEvent read FOnItemObjectDefined write FOnItemObjectDefined;

event is called when new node is created and NodeObject is defined

Published property LoadDataDelay: cardinal read FLoadDataDelay write FLoadDataDelay default 0;

define delay before Masterdatasource scroll and loading to treeview


Generated by PasDoc 0.15.0.