PDA

View Full Version : DoEnumerateTree: Einen Baum durchsuchen



Carsten
11-Jun-2013, 04:36 PM
Hallo zusammen,

ich würde gerne ein Tree-Objekt bzw. deren Kinder durchsuchen und habe diese Prozedur gefunden:



DoEnumerateTree - AbstractTreeView (http://support.dataaccess.com/Forums/AbstractTreeView.htm)

Recurses the items in the control starting with the item you pass, hItem

Type: Procedure (http://support.dataaccess.com/Forums/AbstractTreeView-Methods.htm)

Parameters: Integer (http://support.dataaccess.com/Forums/:/Integer_Type.htm) iMsg Handle (http://support.dataaccess.com/Forums/:/Handle_Type.htm) hItem Integer (http://support.dataaccess.com/Forums/:/Integer_Type.htm) iRecurseLevel

Leider weiß ich überhaupt nicht wie ich das einsetzen kann und auch in der Hilfe und im Forum gibt es kein Beispiel.

Mein Ziel:
6531

Wenn bei Suchwort, z.B. David eingegeben wird, so werden alle Einträge im Baum, welche das Suchwort im 'First Name', 'Last Name' oder 'Company Name' enthalten, im rechten GRID angezeigt.

Hat mir jemand einen Tip wie ich diese Prozedur dafür verwenden kann bzw. wie ich die Parameter verwende?

Vielen Dank
Viele Grüße
Carsten

P.S: Ja ich weiß, das wäre ein idealer Punkt für den Drive-In gewesen :)

Gregg Finney
12-Jun-2013, 05:49 AM
Hello Carsten,

Here is an example of using DoEumerateTree. It adds workspace path settings and then sets the CurrentTreeItem to a item matching some search text. This should get you started on what you want to do.




Procedure ShowLabel Handle hItem
String sLabel sPathLabel sParentLabel sParentLabelSet
Handle hParent
Get psExplorePath of oViewWSFoleders to sPathLabel
Get ParentItem hItem to hParent
Get ItemLabel hParent to sParentLabel
Get ItemLabel hItem to sLabel
Get psParentLabel to sParentLabelSet
If (sPathLabel=sLabel And sParentLabel=sParentLabelSet) Set phoTreeItemSet to hItem
End_Procedure

Procedure OnCreateTree
String sPath sDataPath sDDPath sBitmapPath sAppPath sWs sDFPath sProgramPath sFileListPath
Handle hoWorkSpace hItemRoot hItemChild hItemDD hItemApp hItemBitmap hItemData hItemDfPath
Handle hItemProgramPath
Integer iPath iNumPaths

Set phoTreeItemSet to 0
Get phoWorkSpace of ghoApplication to hoWorkSpace
Get psWorkSpaceName of hoWorkSpace to sWs
Get psDataPath of hoWorkSpace to sDataPath
Get psDDSrcPath of hoWorkSpace to sDDPath
Get psAppSrcPath of hoWorkSpace to sAppPath
Get psBitMapPath of hoWorkSpace to sBitMapPath
Get psProgramPath of hoWorkSpace to sProgramPath
Get psDfPath of hoWorkSpace to sDFPath
Get psFileList of hoWorkSpace to sFileListPath
Get AddTreeItem "[Current WorkSpace]" 0 tiWorkSpace 0 1 To hItemRoot
Get AddTreeItem sWs hItemRoot tiWorkSpace 0 1 To hItemRoot

Get AddTreeItem "Data Path" hItemData tiWorkSpace 0 1 to hItemData
Send DoAddTreeItem sDataPath tiDataPath hItemData hItemChild

Get AddTreeItem "DDSrc Path" 0 tiWorkSpace 0 1 To hItemDD
Send DoAddTreeItem sDDPath tiDDPath hItemDD hItemChild

Get AddTreeItem "Bitmap Path" 0 tiWorkSpace 0 1 To hItemBitmap
Send DoAddTreeItem sBitMapPath tiBitmapPath hItemBitMap hItemChild

Get AddTreeItem "AppSrc Path" 0 tiWorkSpace 0 1 To hItemApp
Send DoAddTreeItem sAppPath tiAppsrcPath hItemApp hItemChild

Get AddTreeItem "Program Path" 0 tiWorkSpace 0 1 to hItemProgramPath
Send DoAddTreeItem sProgramPath tiProgramPath hItemProgramPath hItemChild

Get AddTreeItem "FileList Path" 0 tiWorkSpace 0 1 to hItemDfPath
Send DoAddTreeItem sFileListPath tiFileListPath hItemDfPath hItemChild

Get AddTreeItem "DFPath" 0 tiWorkSpace 0 1 to hItemDfPath
Send DoAddTreeItem sDfPath tiDFPath hItemDfPath hItemChild

Get RootItem to hItemRoot
Send DoExpandAll 0
Set CurrentTreeItem to hItemRoot

Send DoEnumerateTree Msg_ShowLabel hItemRoot 0
If (phoTreeItemSet(Self)) Set CurrentTreeItem to (phoTreeItemSet(Self))
End_Procedure

Dennis Piccioni
12-Jun-2013, 09:19 AM
Hi Carsten,

hoffentlich hilft Dir Greggs Antwort. Ich habe eine Notiz genommen ein Beispiel dafür in der Hilfe zu schreiben, aber das passiert nicht bevor 17.1 herauskommt.

Dennis Piccioni
14-Jun-2013, 09:39 AM
FYI: We added a new TreeView sample view to the existing TreeView sample program in the Specialized Components workspace and some sample code to the help for DoEnumerateTree.