Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Treeview
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Produits tierce partie
Titre:
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
01013476
Message ID:
01013523
Vues:
17
IMHO the MS TV is an amazing control, and it's free. Below is an example using MS Treeview Control 6 (SP4). Cut-n-paste the code into a prg and execute it...
PUBLIC goForm
goForm = CREATEOBJECT("form1")
goform.show()

DEFINE CLASS form1 AS form

    Top = 3
    Left = 0
    Height = 450
    Width = 285
    DoCreate = .T.
    Caption = "Outlook Folders Enumerated"
    nextkey = "1_"
    Name = "Form1"
    lastkey = .F.
    showtips=.T.
    Dockable = 1
	
    ADD OBJECT olecontrol1 AS olecontrol WITH ;
        Appearance = 0, ;
        Top = 0, ;
        Left = 0, ;
        Height = this.height , ;
        Width = this.Width , ;
        Name = "Olecontrol1", ;
        OleClass= "MSComctlLib.TreeCtrl.2",;
        Anchor = 15
	
    PROCEDURE Init
        thisform.loadtreeview()
        thisform.Dock(1)
    ENDPROC
	
    PROCEDURE loadtreeview
        LOCAL loOutlook, loNameSpace, loFolders, lcKey, loNode, lnCounter

        loOutlook = CreateObject('Outlook.Application')
        loNameSpace = loOutlook.GetNameSpace('MAPI')
        loFolders = loNameSpace.Folders

        FOR lnCounter = 1 TO loFolders.COUNT
            lcKey = THISFORM.NewKey()
            loNode = THISFORM.olecontrol1.Nodes.ADD(,, lcKey, loFolders.ITEM(lnCounter).NAME, 0)
            loNode.Expanded = .T.
            IF TYPE("loFolders.ITEM(lnCounter).Folders.count") = "N"
                IF loFolders.ITEM(lnCounter).Folders.COUNT > 0
                    THISFORM.GetChildren(loFolders.ITEM(lnCounter).folders, lcKey)
                ENDIF
            ENDIF
        ENDFOR

        loNameSpace = NULL
        loOutlook = NULL
        RELEASE loNameSpace
        RELEASE loOutlook
    ENDPROC

    PROCEDURE getchildren
        LPARAMETERS toFolder, tcKey
        LOCAL loNode, lnCounter
        FOR lnCounter = 1 TO toFolder.COUNT
            lcKey = THISFORM.NewKey()
            loNode = THISFORM.olecontrol1.Nodes.ADD(tcKey, 4, lcKey, toFolder.ITEM(lnCounter).NAME, 0)
            loNode.Expanded = .T. && Take this line out to speed display
            IF TYPE("toFolder.ITEM(lnCounter).Folders.count") = "N"
                IF toFolder.ITEM(lnCounter).Folders.COUNT > 0
                    THISFORM.GetChildren(toFolder.ITEM(lnCounter).folders, lcKey)
                ENDIF
            ENDIF
        ENDFOR
    ENDPROC

    PROCEDURE newkey
        *!* Procedure Borrowed from VFP example in Solution
        lcKey = THIS.NextKey
        THIS.NextKey = ALLTRIM(STR(VAL(THIS.NextKey) + 1) + "_")
        RETURN lcKey
    ENDPROC

ENDDEFINE
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform