// cDatabaseTreeView.pkg Use dfTreeVw.pkg Use DrgNDrop.pkg Use cImageList32.pkg Use cFileOperations.Pkg Enum_List Define tvNone Define tvExpanding Define tvRefresh End_Enum_List Struct tDBTVFile String sLName Integer iFile End_Struct Struct tDBClass String sDDClass String sDDFile End_Struct Struct tDBDDClasses Integer iTableNo String sTableName String sDDMain String sDDFile tDBClass[] taDDClasses End_Struct Struct tTHDDStructures Integer iFile Integer[] iaSaveFiles Integer[] iaDeleteFiles End_Struct Define DBTV_SORT_BYNUMBER for 0 Define DBTV_SORT_BYNAME for 1 Define THDS_SAVE for 0 Define THDS_DELETE for 1 Use Menu\DatabaseContextMenu.mn Class cDatabaseImageList is a cImageList32 Procedure OnCreate // add the images Integer iImage Get AddBitmap 'dbTreeView16.bmp' clFuchsia to iImage End_Procedure End_Class Class cDatabaseTreeView is a TreeView Procedure Construct_Object Forward Send Construct_Object Property tDBTVFile[] ptDBTVFile Property tDBDDClasses[] ptDDClasses Property tTHDDStructures[] ptTHDDStructures Property Handle[] phDDOs Property Handle phoFileOperation 0 Object oDatabaseImageList is a cDatabaseImageList Set piMaxImages to 8 End_Object Set ImageListObject to (oDatabaseImageList(Self)) Set peAnchors to anAll Set pbEnableInfoTips to True Set piBackColor to gtColorer[EC_TEXT].iBackC Set piTextColor to gtColorer[EC_TEXT].iForeC Set piLineColor to gtColorer[EC_TEXT].iForeC Send CreateFileOperationObject On_Key kCancel Send Request_Cancel End_Procedure // Allows an easy override to use a subclass if it every will be needed in the future Procedure CreateFileOperationObject Handle hoFileOps Get Create (RefClass(cFileOperations)) to hoFileOps Set phoFileOperation to hoFileOps End_Procedure Import_Class_Protocol cDragAndDrop_mx Procedure Mouse_Down2 Integer iT Handle hItem hTable hParent String[] saFileName String sFile Integer iData Get CurrentTreeItem to hItem If (hItem) Begin Get ItemData hItem to hTable Get ParentItem hItem to hParent If ((hTable)and(hParent=0)) Begin Set phTableNumber of (oDatabaseContextMenu(Self)) to hTable Set phInvokingObject of (oDatabaseContextMenu(Self)) to (Object_Id(Self)) Send Popup to (oDatabaseContextMenu(Self)) End End End_Procedure Procedure Request_Cancel If (ghoOutputPane<>0) Begin Send CloseOutputPane of ghoOutputPane Set Windows_Override_State To True // don't pass the message to Windows. End // as otherwise it will still send the keycodes to the queue End_Procedure Function DragAndDrop_DataType Returns String Function_Return "DD_CLASS" End_Function Procedure OnGetInfoTip Handle hItem String ByRef sInfoTip Get ItemFullPath hItem to sInfoTip End_Procedure // OnGetInfoTip Function FindDDSFile Integer hFile tTHDDStructures[] ByRef ltTHDDStructures Returns Integer tTHDDStructures ltTHDDStructure Move hFile to ltTHDDStructure.iFile Move (SearchArray(ltTHDDStructure, ltTHDDStructures)) to hFile If (hFile<0) Move (SizeOfArray(ltTHDDStructures)) to hFile Function_Return hFile End_Function Function mStructure Handle hTable Integer iType Integer iLevel tTHDDStructures[] ByRef ltTHDDStructures tDBDDClasses[] ByRef ltDDClasses Returns String tDBDDClasses ltDDClass Integer iIndex iFile iFiles hParent hChild iMain iDDO iDDOs String sDDO sParentDDO sChildDDO sTitle Handle lhDDO Handle[] lhDDOs // If (iLevel=0) Set phDDOs to lhDDOs Else Get phDDOs to lhDDOs // Get FindDDSFile hTable (<THDDStructures) to iIndex Move ltTHDDStructures[iIndex].iFile to ltDDClass.iTableNo Move (SearchArray(ltDDClass, ltDDClasses)) to iMain Move ltDDClass.iTableNo to lhDDO Move (SearchArray(lhDDO, lhDDOs)) to iDDOs If ((iDDOs<0)and(iMain>=0)) Begin Move lhDDO to lhDDOs[SizeOfArray(lhDDOs)] Set phDDOs to lhDDOs If (iLevel=0) Begin Move (sTitle+"//"*Repeat("*", 45)+Character(10)) to sTitle If (iType=THDS_SAVE) ; Move (sTitle+"// ***** Save Structure for"*ltDDClasses[iMain].sTableName*"table"+Character(10)) to sTitle Else ; Move (sTitle+"// ***** Delete Structure for"*ltDDClasses[iMain].sTableName*"table"+Character(10)) to sTitle Move (sTitle+"//"*Repeat("*", 45)+Character(10)) to sTitle End Move (sDDO+"Object" * ltDDClasses[iMain].sTableName + '_DD is a' * ltDDClasses[iMain].sDDMain+Character(10)) to sDDO // Save Structure Move (SizeOfArray(ltTHDDStructures[iIndex].iaSaveFiles)) to iFiles For iFile from 0 to (iFiles-1) Move ltTHDDStructures[iIndex].iaSaveFiles[iFile] to hParent Move hParent to ltDDClass.iTableNo Move (SearchArray(ltDDClass, ltDDClasses)) to iDDO If (iDDO>=0) Begin Move (sDDO+" "+"Set DDO_Server To" * '('+ltDDClasses[iDDO].sTableName + '_DD(Self))'+Character(10)) to sDDO Get mStructure hParent iType (iLevel+1) (<THDDStructures) (<DDClasses) to sParentDDO If (sParentDDO<>"") Move (sParentDDO+Character(10)+sDDO) to sDDO End Loop // Delete Structure If (iType=THDS_DELETE) Begin Move (SizeOfArray(ltTHDDStructures[iIndex].iaDeleteFiles)) to iFiles For iFile from 0 to (iFiles-1) Move ltTHDDStructures[iIndex].iaDeleteFiles[iFile] to hChild Move hChild to ltDDClass.iTableNo Move (SearchArray(ltDDClass, ltDDClasses)) to iDDO If (iDDO>=0) Begin Get mStructure hChild iType (iLevel+1) (<THDDStructures) (<DDClasses) to sChildDDO End Loop End // Move (sDDO+"End_Object //" * ltDDClasses[iMain].sTableName + "_DD" + Character(10)) to sDDO // If (sChildDDO<>"") Move (sDDO+Character(10)+sChildDDO) to sDDO // If (iLevel=0) Begin Move (sTitle+Character(10)+sDDO+Character(10)) to sDDO Move (sDDO+"Set Main_DD To"*'('+ltDDClasses[iMain].sTableName + "_DD(Self))" + Character(10)) to sDDO Move (sDDO+"Set Server To"*'('+ltDDClasses[iMain].sTableName + "_DD(Self))" + Character(10)) to sDDO // Get phDDOs to lhDDOs Move (SizeOfArray(lhDDOs)) to iDDOs For iDDO from 0 to (iDDOs-1) Move lhDDOs[iDDO] to ltDDClass.iTableNo Move (SearchArray(ltDDClass, ltDDClasses)) to iIndex If (iIndex>=0) Begin If (iDDO=0) Move (Character(10)+sDDO) to sDDO Move ("Use"*ltDDClasses[iIndex].sDDFile+Character(10)+sDDO) to sDDO End Loop End End Function_Return sDDO End_Function Function Table_Drop_Data Handle hItem Returns String String sData Integer iData bOpened hTable iIndex iSegment iSegments iColumn iType String sInfoTip sTable sColumn sSegments sFindInit sType String sC_Indexes sC_Columns sC_Rel sC_DDs sC_Save sC_Delete String sNow Sysdate sNow // Integer iDDO tDBDDClasses[] ltDDClasses tDBDDClasses ltDDClass Get ptDDClasses to ltDDClasses // tTHDDStructures[] ltTHDDStructures Get ptTHDDStructures to ltTHDDStructures // Get ItemData hItem to iData String sDataPath sFileList String sOldDataPath sOldFileList Move (CurrentFileListPath(ghoWorkSpaceHandlerEx)) to sFileList Move (CurrentDataPath(ghoWorkSpaceHandlerEx)) to sDataPath Get_Attribute DF_FILELIST_NAME to sOldFileList Get_Attribute DF_OPEN_PATH to sOldDataPath If (sFileList<>"") Begin Set_Attribute DF_OPEN_PATH to (sDataPath+';'+sOldDataPath) Set_Attribute DF_FILELIST_NAME To sFileList // Set to the new filelist End If iData Begin Get ItemFullPath hItem to sInfoTip Move (_T("Columns", 452)) to sC_Columns Move (_T("Indexes", 453)) to sC_Indexes Move (_T("Relationships", 454)) to sC_Rel Move (_T("Data Dictionaries", 455)) to sC_DDs Move (_T("[Save Structure]", 456)) to sC_Save Move (_T("[Delete Structure]", 457)) to sC_Delete If (sInfoTip contains sC_Indexes) Begin Move (hi(idata)) to hTable Move (Low(idata)) to iIndex Get_Attribute DF_FILE_LOGICAL_NAME of hTable to sTable Get_Attribute DF_FILE_OPENED of hTable to bOpened If (not(bOpened)) Open hTable If (iIndex<>0) Begin Get_Attribute DF_INDEX_NUMBER_SEGMENTS of hTable iIndex to iSegments For iSegment from 1 to iSegments Get_Attribute DF_INDEX_SEGMENT_FIELD of hTable iIndex iSegment to iColumn Get_Attribute DF_FIELD_NAME of hTable iColumn to sColumn Get_Attribute DF_FIELD_TYPE of hTable iColumn to iType If (sSegments="") Move sColumn to sSegments Else Move (sSegments+','*sColumn) to sSegments Move '""' to sType If (iType=DF_BCD) Move 0 to sType If (iType=DF_DATE) Move ("(Date("+sNow+'))') to sType Move (sFindInit+"//Move"*sType*"To"*sTable+'.'+sColumn+Character(10)) to sFindInit Loop If (not(bOpened)) Close hTable Move ("Index."+String(iIndex)*"//"* sSegments) to sSegments End Else Begin Move "Recnum" to sSegments Move ("//Move 0 to"*sTable+".Recnum"+Character(10)) to sFindInit End Move (Character(10)+"Clear"*sTable) to sData Move (sData+Character(10)+sFindInit) to sData Move (sData+("Find EQ"*sTable*"by"*sSegments)) to sData If (not(bOpened)) Close hTable End Else If (sInfoTip contains sC_Columns) Begin Move (hi(idata)) to hTable Get_Attribute DF_FILE_LOGICAL_NAME of hTable to sTable Get_Attribute DF_FILE_OPENED of hTable to bOpened If (not(bOpened)) Open hTable Get_Attribute DF_FIELD_NAME of hTable (Low(idata)) to sColumn Move (Character(10)+sTable+"."+sColumn*'/'+'/'*String(hTable)+'.'+String(Low(idata))) to sData If (not(bOpened)) Close hTable End Else If (sInfoTip contains sC_Rel) Begin Get_Attribute DF_FILE_LOGICAL_NAME of idata to sTable Move (Character(10)+"Relate"*sTable) to sData End Else If (sInfoTip contains sC_DDs) Begin Get_Attribute DF_FILE_LOGICAL_NAME of idata to sTable If (sInfoTip contains sC_Save) Begin Get mStructure idata THDS_SAVE 0 (<THDDStructures) (<DDClasses) to sData End Else If (sInfoTip contains sC_Delete) Begin Get mStructure idata THDS_DELETE 0 (<THDDStructures) (<DDClasses) to sData End Else Begin Move iData to ltDDClass.iTableNo Move (SearchArray(ltDDClass, ltDDClasses)) to iDDO If (iDDO>=0) Begin Move (Character(10)+"Use" * ltDDClasses[iDDO].sDDFile) to sData Move (sData + Character(10)+"Object"*sTable+'_DD is a' * ltDDClasses[iDDO].sDDMain) to sData Move (sData + Character(10)+ "End_Object //" * sTable + "_DD"+Character(10)) to sData End End End Else Begin If (iData>=65536) Move (Hi(iData)) to iData Get_Attribute DF_FILE_LOGICAL_NAME of iData to sTable Move (Character(10)+"Open"*sTable) to sData End End Set_Attribute DF_FILELIST_NAME To sOldFileList Set_Attribute DF_OPEN_PATH to sOldDataPath Function_Return sData End_Function // Can copy items data Procedure Copy Handle hItem Get CurrentTreeItem to hItem Direct_Output "clipboard:" Write (Table_Drop_Data(Self, hItem)) Close_Output End_Procedure Function CanCopy Returns Integer Handle hItem Integer iData Get CurrentTreeItem to hItem If (hItem) Get ItemData hItem to iData Function_Return iData End_Function Function DragAndDrop_GetData Returns String Function_Return (Table_Drop_Data(Self, CurrentTreeItem(Self))) End_Function Function Column_Type Integer iType Returns String Case Begin Case (iType = DF_ASCII) Function_Return "ASC" Case (iType = DF_BCD) Function_Return "NUM" Case (iType = DF_DATE) Function_Return "DAT" Case (iType = DF_OVERLAP) Function_Return "OVL" Case (iType = DF_TEXT) Function_Return "TXT" Case (iType = DF_BINARY) Function_Return "BIN" Case (iType = DF_DATETIME) Function_Return "DTM" Case End Function_Return "???" End_Function Function IsTableNumber String sFilter Returns Integer Integer iChar String sChar For iChar from 1 to (Length(sFilter)) Move (Mid(sFilter, 1, iChar)) to sChar If (not("0123456789" contains sChar)) Function_Return 0 Loop Function_Return sFilter End_Function Function FileOperationOpen Handle hTable Returns Boolean Boolean bOpened Handle hoFileOperation Get phoFileOperation to hoFileOperation If (hoFileOperation) Begin Get Request_Open_File of hoFileOperation hTable to bOpened End Function_Return bOpened End_Function Procedure LoadTableInfo Handle hRoot Boolean bOpened bParent String sLabel Handle hTable hParentFile hParentField iRecnum Handle hColumns hColumn hIndexes hIndex hSegment hLink hLinks Handle hDDOs hDD hoClient String sTable sDisplay sColumn sType sLength sParentFile sParentField sTblNo Integer iColumn iColumns iType iLength iPrecision iData Integer iIndex iIndexes iSegment iSegments iLink iLinks iDDOs iDD Integer iTables iTable iDDS iMainFile iParentFile String[] laLinks laDummy tDBTVFile[] latDBTVFile tDBDDClasses[] ltDDClasses tTHDDStructures[] ltTHDDStructures tDBDDClasses ltDDClass // String sDataPath sFileList String sOldDataPath sOldFileList Get ItemLabel hRoot to sLabel Get ItemData hRoot to hTable Get ptTHDDStructures to ltTHDDStructures Get ptDDClasses to ltDDClasses Get ptDBTVFile to latDBTVFile Move (CurrentFileListPath(ghoWorkSpaceHandlerEx)) to sFileList Move (CurrentDataPath(ghoWorkSpaceHandlerEx)) to sDataPath Get_Attribute DF_FILELIST_NAME to sOldFileList Get_Attribute DF_OPEN_PATH to sOldDataPath If (sFileList<>"") Begin Set_Attribute DF_OPEN_PATH to (sDataPath+';'+sOldDataPath) Set_Attribute DF_FILELIST_NAME To sFileList // Set to the new filelist End Send Cursor_Wait of Cursor_Control Get FileOperationOpen hTable to bOpened If (bOpened) Begin Get_Attribute DF_FILE_LOGICAL_NAME of hTable to sTable Get_Attribute DF_FILE_RECNUM_TABLE of hTable to iRecnum // Columns Get AddTreeItem (_T("Columns", 452)) hRoot 0 1 1 to hColumns Get_Attribute DF_FILE_NUMBER_FIELDS of hTable to iColumns For iColumn from 1 to iColumns Get_Attribute DF_FIELD_NAME of hTable iColumn to sColumn Get_Attribute DF_FIELD_TYPE of hTable iColumn to iType Get_Attribute DF_FIELD_LENGTH of hTable iColumn to iLength Get_Attribute DF_FIELD_PRECISION of hTable iColumn to iPrecision Get_Attribute DF_FIELD_RELATED_FILE of hTable iColumn to hParentFile Get_Attribute DF_FIELD_RELATED_FIELD of hTable iColumn to hParentField Move iLength to sLength If iPrecision Move (sLength+'.'+String(iPrecision)) to sLength Get Column_Type iType to sType If (iType=DF_DATE) Move "" to sLength If (iType=DF_DATETIME) Move "" to sLength // Modified (DTM) // Batch# (ASC40) Move (sColumn*'('+sType+sLength+')') to sLabel Get AddTreeItem sLabel hColumns 0 2 2 to hColumn Move (65536 * hTable + iColumn) to iData Set ItemData hColumn to iData If (hParentFile+hParentField) Begin Get FindDDSFile hParentFile (<THDDStructures) to iParentFile Move hParentFile to ltTHDDStructures[iParentFile].iFile Move hParentFile to ltTHDDStructures[iMainFile].iaSaveFiles[SizeOfArray(ltTHDDStructures[iMainFile].iaSaveFiles)] // Move hTable to ltTHDDStructures[iParentFile].iaDeleteFiles[SizeOfArray(ltTHDDStructures[iParentFile].iaDeleteFiles)] // Get FileOperationOpen hParentFile to bParent If (LastErr=74 or LastErr=75) Begin If (LastErr=74) Send UserError (_T("Table", 1596)+" #"*Trim(hParentFile)*_T("is not in the filelist, but was attempted to open as parent for Table",1598)*sTblNo*sDisplay) // Can't get the exact names, but we can show numbers Move (_T("Table", 1596)+Trim(hParentFile)) to sParentFile Move (_T("Column", 1597)+Trim(hParentField)) to sParentField End Else Begin Get_Attribute DF_FILE_OPENED of hParentFile to bParent Get_Attribute DF_FILE_LOGICAL_NAME of hParentFile to sParentFile If (bParent) Begin Get_Attribute DF_FIELD_NAME of hParentFile hParentField to sParentField End Else Move ("FIELD"+Trim(hParentField)) to sParentField End Move (sTable+'.'+sColumn+' > '+sParentFile+'.'+sParentField) to laLinks[SizeOfArray(laLinks)] If (bParent) Close hParentFile End Loop // Indexes Get AddTreeItem (_T("Indexes", 453)) hRoot 0 3 3 to hIndexes If iRecnum Begin Get AddTreeItem "Recnum" hIndexes 0 4 4 to hIndex Move (65536 * hTable + 0) to iData Set ItemData hIndex to iData End Get_Attribute DF_FILE_LAST_INDEX_NUMBER of hTable to iIndexes For iIndex from 1 to iIndexes Get_Attribute DF_INDEX_NUMBER_SEGMENTS of hTable iIndex to iSegments Get AddTreeItem ("Index."+String(iIndex)) hIndexes 0 4 4 to hIndex Move (65536 * hTable + iIndex) to iData Set ItemData hIndex to iData For iSegment from 1 to iSegments Get_Attribute DF_INDEX_SEGMENT_FIELD of hTable iIndex iSegment to iColumn Get_Attribute DF_FIELD_NAME of hTable iColumn to sColumn Get AddTreeItem sColumn hIndex 0 2 2 to hColumn Set ItemData hColumn to iData Loop Loop // Links Get AddTreeItem (_T("Relationships", 454)) hRoot 0 5 5 to hLinks Move (SizeOfArray(laLinks)-1) to iLinks For iLink from 0 to iLinks Get AddTreeItem laLinks[iLink] hLinks 0 6 6 to hColumn Set ItemData hColumn to hTable Loop // DDOs Get AddTreeItem (_T("Data Dictionaries", 455)) hRoot 0 7 7 to hDDOs Move hTable to ltDDClass.iTableNo Move (SearchArray(ltDDClass, ltDDClasses)) to iDDS If (iDDS>=0) Begin Get AddTreeItem (_T("[Save Structure]", 456)) hDDOs 0 9 9 to hDD Set ItemData hDD to hTable // needs to be hi-bit Get AddTreeItem (_T("[Delete Structure]", 457)) hDDOs 0 10 10 to hDD Set ItemData hDD to hTable // needs to be hi-bit Move (SizeOfArray(ltDDClasses[iDDS].taDDClasses)) to iDDOs For iDD from 0 to (iDDOs-1) Get AddTreeItem ltDDClasses[iDDS].taDDClasses[iDD].sDDClass hDDOs 0 8 8 to hDD Set ItemData hDD to hTable Loop End If (bOpened) Close hTable End Else Begin Get AddTreeItem (_T("File open Error", 458)) hRoot 0 1 1 to hColumns End Send Cursor_ready of Cursor_Control Set_Attribute DF_FILELIST_NAME To sOldFileList Set_Attribute DF_OPEN_PATH to sOldDataPath Set ptTHDDStructures to ltTHDDStructures End_Procedure Procedure LoadTablesList Integer iSortBy String sFilter Handle hTable hParentFile hParentField iRecnum Handle hRoot hColumns hColumn hIndexes hIndex hSegment hLink hLinks Handle hDDOs hDD hoClient String sTable sDisplay sColumn sType sLength sParentFile sParentField sTblNo Integer iColumn iColumns bOpened iType iLength iPrecision iData Integer iIndex iIndexes iSegment iSegments iLink iLinks iDDOs iDD Integer iTables iTable iDDS iMainFile iParentFile Boolean bSelected String[] laLinks laDummy tDBTVFile[] latDBTVFile tDBDDClasses[] ltDDClasses tTHDDStructures[] ltTHDDStructures tDBDDClasses ltDDClass // String sDataPath sFileList String sOldDataPath sOldFileList // Get Client_Id to hoClient Send LoadDDClassList of hoClient (<DDClasses) Set ptDDClasses to ltDDClasses // Move (CurrentFileListPath(ghoWorkSpaceHandlerEx)) to sFileList Move (CurrentDataPath(ghoWorkSpaceHandlerEx)) to sDataPath Get_Attribute DF_FILELIST_NAME to sOldFileList Get_Attribute DF_OPEN_PATH to sOldDataPath If (sFileList<>"") Begin Set_Attribute DF_OPEN_PATH to (sDataPath+';'+sOldDataPath) Set_Attribute DF_FILELIST_NAME To sFileList // Set to the new filelist End // Send ClearAll Move (Trim(Uppercase(sFilter))) to sFilter // Collect Database Files Move 0 to hTable Repeat Get_Attribute DF_FILE_NEXT_USED of hTable to hTable If (hTable > 0) Begin Get_Attribute DF_FILE_LOGICAL_NAME of hTable to sTable Get_Attribute DF_FILE_DISPLAY_NAME of hTable to sDisplay Move (sFilter="") to bSelected If (not(bSelected)) Move (Uppercase(sTable) contains sFilter) to bSelected If (not(bSelected)) Move (IsTableNumber(Self, sFilter)=hTable) to bSelected If (not(bSelected)) Move (Uppercase(sDisplay) contains sFilter) to bSelected If bSelected Begin Move (SizeOfArray(latDBTVFile)) to iTables Move hTable to latDBTVFile[iTables].iFile Move (Uppercase(sTable)) to latDBTVFile[iTables].sLName End End Until (hTable = 0) Move (SizeOfArray(latDBTVFile)) to iTables If (iTables=0) Begin Set_Attribute DF_FILELIST_NAME To sOldFileList Set_Attribute DF_OPEN_PATH to sOldDataPath Procedure_Return End // Close DF_ALL // If ((iSortBy=DBTV_SORT_BYNAME)and(iTables>1)) begin Move (SortArray(latDBTVFile)) to latDBTVFile end // Output For iTable from 0 to (iTables-1) Move latDBTVFile[iTable].iFile to hTable If (hTable > 0) Begin Move laDummy to laLinks // Tables Get_Attribute DF_FILE_LOGICAL_NAME of hTable to sTable If (Uppercase(sTable)<>"FLEXERRS") Begin Get FindDDSFile hTable (<THDDStructures) to iMainFile Move hTable to ltTHDDStructures[iMainFile].iFile Get_Attribute DF_FILE_DISPLAY_NAME of hTable to sDisplay Move (Right("0000"+String(hTable), 4)) to sTblNo If (iSortBy=DBTV_SORT_BYNAME) Get AddTreeItem (sTable*'['+String(hTable)+','*sDisplay+']') 0 0 0 0 to hRoot Else Get AddTreeItem (sTblNo*'-'*sTable*'['+sDisplay+']') 0 0 0 0 to hRoot Set ItemData hRoot to hTable Set ItemChildCount hRoot to 1 End // FLEXERRS exclude End Loop // Set_Attribute DF_FILELIST_NAME To sOldFileList Set_Attribute DF_OPEN_PATH to sOldDataPath // // By opening/closing all the files on request it is easier to use // the files in other tools like database builder. Close DF_ALL // Set ptTHDDStructures to ltTHDDStructures Set ptDBTVFile to latDBTVFile // End_Procedure Procedure OnCreateTree Send LoadTablesList DBTV_SORT_BYNUMBER "" End_Procedure Procedure ItemRefresh Handle hRoot Integer eMode Boolean bHasExpanded Handle hTable Get ItemData hRoot to hTable Move (True) to bHasExpanded If (eMode=tvExpanding) Get ExpandedOnceState hRoot to bHasExpanded If (not(bHasExpanded) and hTable > 0 and hTable < 65536) Begin Send LoadTableInfo hRoot End End_Procedure Procedure OnItemExpanding Handle hItem Boolean ByRef bCancel // Move True to bCancel Send ItemRefresh hItem tvExpanding // Expanding End_Procedure Procedure OnItemChanged Handle hItem Handle hItemOld Send ItemRefresh hItem tvRefresh // Changed End_Procedure End_Class