Class TCustomDBTreeView (unit DBTreeView98)

Inherits from

TWinControl

Constructors


constructor Create(AOwner: TComponent);

TCustomDBTreeView


Functions

function AddItem(Parent, Target: HTreeItem; Code: Longint): HTreeItem;


function AlphaSort(Parent: HTreeItem): Boolean;


function CustomSort(SortProc: TTVCompare): Boolean;

if HandleAllocated then begin Result := CustomSort(nil); for i := 0 to GetChildrenCount - 1 do with Items[I] do if HasChildren then AlphaSort; end else Result := False;

destructor Destroy;


function FindItemData(Code: Longint): HTreeItem;


procedure FullCollapse;


procedure FullExpand;


function GetHitTestInfoAt(X, Y: Integer): THitTests;


function GetNodeAt(X, Y: Integer): HTreeItem;


function IsEditing: Boolean;


function CanChange(Node: HTreeItem): Boolean;

procedure TCustomDBTreeView.

function CanCollapse(Node: HTreeItem): Boolean;


function CanEdit(Node: HTreeItem): Boolean;


function CanExpand(Node: HTreeItem): Boolean;


procedure Change(Node: HTreeItem);


procedure Collapse(Node: HTreeItem);


procedure CreateParams(var Params: TCreateParams);


procedure CreateWnd;


procedure DestroyWnd;


procedure DoEndDrag(Target: TObject; X, Y: Integer);


procedure DoStartDrag(var DragObject: TDragObject);


procedure Edit(const Item: TTVItem);


procedure Expand(Node: HTreeItem);


function GetDragImages: TCustomImageList;

FOldFrom:= GetItem(Node).

procedure KeyDown(var Key: Word; Shift: TShiftState);

if FDatalink.

procedure Loaded;


procedure Notification(AComponent: TComponent; Operation: TOperation);


procedure SetDragMode(Value: TDragMode);


procedure WndProc(var Message: TMessage);


function AcquireFocus: Boolean;


procedure CMColorChanged(var Message: TMessage);


procedure CMCtl3DChanged(var Message: TMessage);


procedure CMDrag(var Message: TCMDrag);


procedure CMSysColorChange(var Message: TMessage);


procedure CNNotify(var Message: TWMNotify);


procedure CollapseItem(Item: HTreeItem; Recurse: Boolean);


procedure DataChanged;

procedure UpdateRowCount;

if ( csDesigning in ComponentState ) then Exit;


procedure DeleteItem(Item: HTreeItem);

function GetNextItem(Item: HTreeItem): HTreeItem;

procedure DoDragOver(Source: TDragObject; X, Y: Integer; CanDrop: Boolean);


procedure EditingChanged;


procedure EditWndProc(var Message: TMessage);


procedure ExpandItem(Item: HTreeItem; Recurse: Boolean);

function TCustomDBTreeView.

procedure FocusItem(Item: HTreeItem; Value: Boolean);


function GetDataSource: TDataSource;

procedure TCustomDBTreeView.

function GetDropTarget: HTreeItem;

procedure GetImageIndex(Node: HTreeItem); procedure GetSelectedIndex(Node: HTreeItem);

function GetIndent: Integer;


function GetItem(Item: HTreeItem): TTVItem;

function GetChildrenCount(Item: HTreeItem): Integer;

function TCustomDBTreeView.


function GetItemChild(Item: HTreeItem): Boolean;

Work around NT COMCTL32 problem with tool tips >= 80 characters

function GetItemState(Item: HTreeItem; NodeState: TNodeState): Boolean;


function GetSelection: HTreeItem;


function GetTopItem: HTreeItem;


function HasAsParent(Item, Value: HTreeItem): Boolean;


procedure HideEditor;


procedure ImageListChange(Sender: TObject);


procedure LinkActive(Value: Boolean);


procedure RecordChanged(Field: TField);


procedure ScrollData(Distance: Integer);

LinkActive(FDataLink.

function SelectedField: TField;


procedure SetBorderStyle(Value: TBorderStyle);


procedure SetButtonStyle(Value: Boolean);


procedure SetCheckboxes(Value: Boolean);


procedure SetColorFieldName(Value: String);

AField:= nil;

procedure SetDataSource(Value: TDataSource);


procedure SetDetailFieldName(Value: String);

no exceptions

procedure SetDropTarget(Value: HTreeItem);


procedure SetHideSelection(Value: Boolean);


procedure SetHotTrack(Value: Boolean);


procedure SetIconFieldName(Value: String);

no exceptions

procedure SetImageList(Value: HImageList; Flags: Integer);

if Node <> nil then Node.

procedure SetImages(Value: TImageList);


procedure SetIndent(Value: Integer);


procedure SetItemFieldName(Value: String);

no exceptions

procedure SetLineStyle(Value: Boolean);


procedure SetMasterFieldName(Value: String);

VK_INSERT: if CanModify and (not ReadOnly) then begin ClearSelection; NewItem; end;

procedure SetReadOnly(Value: Boolean);


procedure SetRootStyle(Value: Boolean);


procedure SetRowSelect(Value: Boolean);

AField:= nil;

procedure SetSelection(Value: HTreeItem);


procedure SetSortType(Value: TSortType);

for I := 0 to Items.

procedure SetStateImages(Value: TImageList);


procedure SetStyle(Value: Integer; UseStyle: Boolean);


procedure SetToolTips(Value: Boolean);


procedure SetTopItem(Value: HTreeItem);


procedure ShowEditor;

FOnGetImageIndex: TDBTVExpandedEvent; FOnGetSelectedIndex: TDBTVExpandedEvent;

procedure UpdateActive;


procedure UpdateData;


function ValidDataSet: Boolean;

ListView_EnsureVisible(Handle, Selected, TRUE);

procedure WMLButtonDown(var Message: TWMLButtonDown);


procedure WMNotify(var Message: TWMNotify);


procedure WMRButtonDown(var Message: TWMRButtonDown);


procedure WMRButtonUp(var Message: TWMRButtonUp);


Properties

property Checkboxes : Boolean


property ColorFieldName : string


property DataLink : TTreeViewDataLink


property DataSource : TDataSource


property DetailFieldName : string


property DropTarget : HTreeItem


property HotTrack : Boolean


property IconFieldName : string


property ItemFieldName : string


property MasterFieldName : string


property Selected : HTreeItem


property StartMasterValue : string


property ToolTips : Boolean


property TopItem : HTreeItem


property BorderStyle : TBorderStyle


property HideSelection : Boolean


property Images : TImageList


property Indent : Integer


property ReadOnly : Boolean


property RightClickSelect : Boolean


property RowSelect : Boolean


property ShowButtons : Boolean

property OnGetImageIndex: TDBTVExpandedEvent read FOnGetImageIndex write FOnGetImageIndex; property OnGetSelectedIndex: TDBTVExpandedEvent read FOnGetSelectedIndex write FOnGetSelectedIndex;

property ShowLines : Boolean


property ShowRoot : Boolean


property SortType : TSortType


property StateImages : TImageList


Events

event OnAskForColor : TDBTVAskForColor


event OnAskForIcon : TDBTVAskForIcon


event OnChange : TDBTVChangedEvent


event OnChanging : TDBTVChangingEvent


event OnCollapsed : TDBTVExpandedEvent


event OnCollapsing : TDBTVCollapsingEvent


event OnCompare : TDBTVCompareEvent


event OnDeletion : TDBTVExpandedEvent


event OnEdited : TDBTVEditedEvent


event OnEditing : TDBTVEditingEvent


event OnExpanded : TDBTVExpandedEvent


event OnExpanding : TDBTVExpandingEvent


Variables

FAcquireFocus : Boolean;


FBorderStyle : TBorderStyle;


FCheckboxes : Boolean;


FColorFieldName : string;


FDataLink : TTreeViewDataLink;


FDefEditProc : Pointer;


FDetailFieldName : string;


FDetailTable : TTable;


FDragged : Boolean;


FDragImage : TImageList;


FDragNode : HTreeItem;


FEditHandle : HWND;


FEditInstance : Pointer;


FHideSelection : Boolean;


FHotTrack : Boolean;


FIconFieldName : string;


FImageChangeLink : TChangeLink;


FImages : TImageList;


FItemFieldName : string;


FKeepChildCount : Integer;


FKeepColor : Integer;


FKeepImage : Integer;


FKeepText : String;


FLastDropTarget : HTreeItem;


FManualNotify : Boolean;


FMasterFieldName : string;


FOldActive : Integer;


FOldFrom : Integer;


FOldSelection : Integer;


FOnAskForColor : TDBTVAskForColor;


FOnAskForIcon : TDBTVAskForIcon;


FOnChange : TDBTVChangedEvent;


FOnChanging : TDBTVChangingEvent;


FOnCollapsed : TDBTVExpandedEvent;


FOnCollapsing : TDBTVCollapsingEvent;


FOnCompare : TDBTVCompareEvent;


FOnDeletion : TDBTVExpandedEvent;


FOnEdited : TDBTVEditedEvent;


FOnEditing : TDBTVEditingEvent;


FOnExpanded : TDBTVExpandedEvent;


FOnExpanding : TDBTVExpandingEvent;


FRClickNode : HTreeItem;


FReadOnly : Boolean;


FRightClickSelect : Boolean;


FRowSelect : Boolean;


FSaveIndent : Integer;


FShowButtons : Boolean;


FShowLines : Boolean;


FShowRoot : Boolean;


FSortType : TSortType;


FStartMasterValue : string;


FStateChangeLink : TChangeLink;


FStateChanging : Boolean;


FStateImages : TImageList;


FTooltips : Boolean;


FUpdateLock : Boolean;


FWideText : WideString;



Constructors


constructor Create(AOwner: TComponent);

TCustomDBTreeView


Functions


function AddItem(Parent, Target: HTreeItem; Code: Longint): HTreeItem;


function AlphaSort(Parent: HTreeItem): Boolean;


function CustomSort(SortProc: TTVCompare): Boolean;

if HandleAllocated then begin Result := CustomSort(nil); for i := 0 to GetChildrenCount - 1 do with Items[I] do if HasChildren then AlphaSort; end else Result := False;


destructor Destroy;


function FindItemData(Code: Longint): HTreeItem;


procedure FullCollapse;


procedure FullExpand;


function GetHitTestInfoAt(X, Y: Integer): THitTests;


function GetNodeAt(X, Y: Integer): HTreeItem;


function IsEditing: Boolean;


function CanChange(Node: HTreeItem): Boolean;

procedure TCustomDBTreeView.GetImageIndex(Node: HTreeItem); begin if Assigned(FOnGetImageIndex) then FOnGetImageIndex(Self, Node); end;} {procedure TCustomDBTreeView.GetSelectedIndex(Node: HTreeItem); begin if Assigned(FOnGetSelectedIndex) then FOnGetSelectedIndex(Self, Node); end;


function CanCollapse(Node: HTreeItem): Boolean;


function CanEdit(Node: HTreeItem): Boolean;


function CanExpand(Node: HTreeItem): Boolean;


procedure Change(Node: HTreeItem);


procedure Collapse(Node: HTreeItem);


procedure CreateParams(var Params: TCreateParams);


procedure CreateWnd;


procedure DestroyWnd;


procedure DoEndDrag(Target: TObject; X, Y: Integer);


procedure DoStartDrag(var DragObject: TDragObject);


procedure Edit(const Item: TTVItem);


procedure Expand(Node: HTreeItem);


function GetDragImages: TCustomImageList;

FOldFrom:= GetItem(Node).lParam;


procedure KeyDown(var Key: Word; Shift: TShiftState);

if FDatalink.Active and HandleAllocated and not (csLoading in ComponentState) then begin NewRow := FDatalink.ActiveRecord; if Selected <> NewRow then begin HideEditor; SetSelection(NewRow+TopItem); end; end;


procedure Loaded;


procedure Notification(AComponent: TComponent; Operation: TOperation);


procedure SetDragMode(Value: TDragMode);


procedure WndProc(var Message: TMessage);


function AcquireFocus: Boolean;


procedure CMColorChanged(var Message: TMessage);


procedure CMCtl3DChanged(var Message: TMessage);


procedure CMDrag(var Message: TCMDrag);


procedure CMSysColorChange(var Message: TMessage);


procedure CNNotify(var Message: TWMNotify);


procedure CollapseItem(Item: HTreeItem; Recurse: Boolean);


procedure DataChanged;

procedure UpdateRowCount;

if ( csDesigning in ComponentState ) then Exit;


procedure DeleteItem(Item: HTreeItem);

function GetNextItem(Item: HTreeItem): HTreeItem;


procedure DoDragOver(Source: TDragObject; X, Y: Integer; CanDrop: Boolean);


procedure EditingChanged;


procedure EditWndProc(var Message: TMessage);


procedure ExpandItem(Item: HTreeItem; Recurse: Boolean);

function TCustomDBTreeView.GetNextItem(Item: HTreeItem): HTreeItem; var NodeID, ParentID: HTreeItem; begin NodeID := TreeView_GetChild(Handle, Item); if NodeID = nil then NodeID := TreeView_GetNextSibling(Handle, Item); ParentID := Item; while (NodeID = nil) and (ParentID <> nil) do begin ParentID := TreeView_GetParent(Handle, ParentID); NodeID := TreeView_GetNextSibling(Handle, ParentID); end; Result := NodeID; end;


procedure FocusItem(Item: HTreeItem; Value: Boolean);


function GetDataSource: TDataSource;

procedure TCustomDBTreeView.UpdateRowCount; begin if Not ValidDataSet then Exit; //if Count <= 1 then Count:= 1; with FDataLink do if not Active or (RecordCount = 0) or not HandleAllocated then //Count := 0 else begin //Count := FDataLink.DataSet.RecordCount; FDataLink.BufferCount := FDataLink.DataSet.RecordCount; //Count; //VisibleCount; UpdateActive; end; end;


function GetDropTarget: HTreeItem;

procedure GetImageIndex(Node: HTreeItem); procedure GetSelectedIndex(Node: HTreeItem);


function GetIndent: Integer;


function GetItem(Item: HTreeItem): TTVItem;

function GetChildrenCount(Item: HTreeItem): Integer;

function TCustomDBTreeView.GetChildrenCount(Item: HTreeItem): Integer; var Node: HTreeItem; begin Result := 0; Node := TreeView_GetChild(Handle, Item); while Node <> nil do begin Inc(Result); Node := TreeView_GetNextSibling(Handle, Node); end; end;


function GetItemChild(Item: HTreeItem): Boolean;

Work around NT COMCTL32 problem with tool tips >= 80 characters


function GetItemState(Item: HTreeItem; NodeState: TNodeState): Boolean;


function GetSelection: HTreeItem;


function GetTopItem: HTreeItem;


function HasAsParent(Item, Value: HTreeItem): Boolean;


procedure HideEditor;


procedure ImageListChange(Sender: TObject);


procedure LinkActive(Value: Boolean);


procedure RecordChanged(Field: TField);


procedure ScrollData(Distance: Integer);

LinkActive(FDataLink.Active);


function SelectedField: TField;


procedure SetBorderStyle(Value: TBorderStyle);


procedure SetButtonStyle(Value: Boolean);


procedure SetCheckboxes(Value: Boolean);


procedure SetColorFieldName(Value: String);

AField:= nil;


procedure SetDataSource(Value: TDataSource);


procedure SetDetailFieldName(Value: String);

no exceptions


procedure SetDropTarget(Value: HTreeItem);


procedure SetHideSelection(Value: Boolean);


procedure SetHotTrack(Value: Boolean);


procedure SetIconFieldName(Value: String);

no exceptions


procedure SetImageList(Value: HImageList; Flags: Integer);

if Node <> nil then Node.Text := S;


procedure SetImages(Value: TImageList);


procedure SetIndent(Value: Integer);


procedure SetItemFieldName(Value: String);

no exceptions


procedure SetLineStyle(Value: Boolean);


procedure SetMasterFieldName(Value: String);

VK_INSERT: if CanModify and (not ReadOnly) then begin ClearSelection; NewItem; end;


procedure SetReadOnly(Value: Boolean);


procedure SetRootStyle(Value: Boolean);


procedure SetRowSelect(Value: Boolean);

AField:= nil;


procedure SetSelection(Value: HTreeItem);


procedure SetSortType(Value: TSortType);

for I := 0 to Items.Count - 1 do begin Node := Items[I]; if Node.HasChildren then Node.CustomSort(SortProc, Data); end;


procedure SetStateImages(Value: TImageList);


procedure SetStyle(Value: Integer; UseStyle: Boolean);


procedure SetToolTips(Value: Boolean);


procedure SetTopItem(Value: HTreeItem);


procedure ShowEditor;

FOnGetImageIndex: TDBTVExpandedEvent; FOnGetSelectedIndex: TDBTVExpandedEvent;


procedure UpdateActive;


procedure UpdateData;


function ValidDataSet: Boolean;

ListView_EnsureVisible(Handle, Selected, TRUE);


procedure WMLButtonDown(var Message: TWMLButtonDown);


procedure WMNotify(var Message: TWMNotify);


procedure WMRButtonDown(var Message: TWMRButtonDown);


procedure WMRButtonUp(var Message: TWMRButtonUp);


Properties


property Checkboxes : Boolean


property ColorFieldName : string


property DataLink : TTreeViewDataLink


property DataSource : TDataSource


property DetailFieldName : string


property DropTarget : HTreeItem


property HotTrack : Boolean


property IconFieldName : string


property ItemFieldName : string


property MasterFieldName : string


property Selected : HTreeItem


property StartMasterValue : string


property ToolTips : Boolean


property TopItem : HTreeItem


property BorderStyle : TBorderStyle


property HideSelection : Boolean


property Images : TImageList


property Indent : Integer


property ReadOnly : Boolean


property RightClickSelect : Boolean


property RowSelect : Boolean


property ShowButtons : Boolean

property OnGetImageIndex: TDBTVExpandedEvent read FOnGetImageIndex write FOnGetImageIndex; property OnGetSelectedIndex: TDBTVExpandedEvent read FOnGetSelectedIndex write FOnGetSelectedIndex;


property ShowLines : Boolean


property ShowRoot : Boolean


property SortType : TSortType


property StateImages : TImageList


Events


event OnAskForColor : TDBTVAskForColor


event OnAskForIcon : TDBTVAskForIcon


event OnChange : TDBTVChangedEvent


event OnChanging : TDBTVChangingEvent


event OnCollapsed : TDBTVExpandedEvent


event OnCollapsing : TDBTVCollapsingEvent


event OnCompare : TDBTVCompareEvent


event OnDeletion : TDBTVExpandedEvent


event OnEdited : TDBTVEditedEvent


event OnEditing : TDBTVEditingEvent


event OnExpanded : TDBTVExpandedEvent


event OnExpanding : TDBTVExpandingEvent


Variables


FAcquireFocus : Boolean;


FBorderStyle : TBorderStyle;


FCheckboxes : Boolean;


FColorFieldName : string;


FDataLink : TTreeViewDataLink;


FDefEditProc : Pointer;


FDetailFieldName : string;


FDetailTable : TTable;


FDragged : Boolean;


FDragImage : TImageList;


FDragNode : HTreeItem;


FEditHandle : HWND;


FEditInstance : Pointer;


FHideSelection : Boolean;


FHotTrack : Boolean;


FIconFieldName : string;


FImageChangeLink : TChangeLink;


FImages : TImageList;


FItemFieldName : string;


FKeepChildCount : Integer;


FKeepColor : Integer;


FKeepImage : Integer;


FKeepText : String;


FLastDropTarget : HTreeItem;


FManualNotify : Boolean;


FMasterFieldName : string;


FOldActive : Integer;


FOldFrom : Integer;


FOldSelection : Integer;


FOnAskForColor : TDBTVAskForColor;


FOnAskForIcon : TDBTVAskForIcon;


FOnChange : TDBTVChangedEvent;


FOnChanging : TDBTVChangingEvent;


FOnCollapsed : TDBTVExpandedEvent;


FOnCollapsing : TDBTVCollapsingEvent;


FOnCompare : TDBTVCompareEvent;


FOnDeletion : TDBTVExpandedEvent;


FOnEdited : TDBTVEditedEvent;


FOnEditing : TDBTVEditingEvent;


FOnExpanded : TDBTVExpandedEvent;


FOnExpanding : TDBTVExpandingEvent;


FRClickNode : HTreeItem;


FReadOnly : Boolean;


FRightClickSelect : Boolean;


FRowSelect : Boolean;


FSaveIndent : Integer;


FShowButtons : Boolean;


FShowLines : Boolean;


FShowRoot : Boolean;


FSortType : TSortType;


FStartMasterValue : string;


FStateChangeLink : TChangeLink;


FStateChanging : Boolean;


FStateImages : TImageList;


FTooltips : Boolean;


FUpdateLock : Boolean;


FWideText : WideString;