object SelectDeptDlg: TSelectDeptDlg Left = 677 Height = 449 Top = 296 Width = 485 BorderStyle = bsDialog Caption = 'Select Department' ClientHeight = 449 ClientWidth = 485 OnClose = FormClose OnShow = FormShow Position = poMainFormCenter LCLVersion = '1.8.0.4' object Label1: TLabel Left = 16 Height = 14 Top = 16 Width = 79 Caption = 'Departments' ParentColor = False end object DeptsTreeView: TIBTreeView Left = 19 Height = 399 Top = 37 Width = 359 TextField = 'DEPARTMENT' DataSource = DataSource1 HasChildField = 'CHILDCOUNT' KeyField = 'DEPT_NO' ParentField = 'HEAD_DEPT' ReadOnly = True RelationName = 'A' TabOrder = 0 OnDblClick = DeptsTreeViewDblClick Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips, tvoThemedDraw] end object Button1: TButton Left = 394 Height = 30 Top = 37 Width = 75 Caption = 'OK' Default = True ModalResult = 1 TabOrder = 1 end object Button2: TButton Left = 394 Height = 30 Top = 72 Width = 75 Cancel = True Caption = 'Cancel' ModalResult = 2 TabOrder = 2 end object Depts: TIBQuery AllowAutoActivateTransaction = False Database = Form1.IBDatabase1 Transaction = Form1.IBTransaction1 BufferChunks = 1000 CachedUpdates = False GenerateParamNames = False GeneratorField.ApplyOnEvent = gaeOnNewRecord SQL.Strings = ( 'Select A.DEPT_NO, A.DEPARTMENT, A.HEAD_DEPT,count(B.DEPT_NO)' 'as ChildCount ' 'From DEPARTMENT A' 'Left Outer JOIN DEPARTMENT B ' ' On B.HEAD_DEPT = A.DEPT_NO' 'Group By A.DEPT_NO, A.DEPARTMENT, A.HEAD_DEPT' ) Params = <> DataSetCloseAction = dcDiscardChanges left = 432 top = 125 end object DataSource1: TDataSource DataSet = Depts left = 392 top = 125 end end