Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Add properties to treeview
Message
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01268950
Message ID:
01269000
Views:
14
>You can do:
>
>
>
>  oNode = thisform.treeview.nodes.add(....
>
>  ADDPROPERTY(oNode, cPropertyName, ePropertyValue)
>
>
>
>
>
>
>>hi
>>There exists a way of being able to add a property to every node of this control
>>
>>As for example thisform.addpropety ("mypropety")

And how did you get it back?
oForm = NEWOBJECT([Form1])
oForm.Show(1)


**************************************************
*-- Form:         form1 (d:\test\test.scx)
*-- ParentClass:  form
*-- BaseClass:    form
*-- Time Stamp:   11/14/07 09:28:04 PM
*
DEFINE CLASS form1 AS form


    Top = 0
    Left = 0
    Height = 253
    Width = 475
    DoCreate = .T.
    Caption = "Form1"
    mynodeproperties = .F.
    Name = "Form1"


    ADD OBJECT oletree AS olecontrol WITH ;
        Top = 1, ;
        Left = 24, ;
        Height = 240, ;
        Width = 334, ;
        Name = "oleTree",;
        oleClass=[MSComctlLib.TreeCtrl.2]


    ADD OBJECT text1 AS textbox WITH ;
        Height = 23, ;
        Left = 370, ;
        Top = 4, ;
        Width = 100, ;
        Name = "Text1"


    ADD OBJECT text2 AS textbox WITH ;
        Height = 23, ;
        Left = 370, ;
        Top = 37, ;
        Width = 100, ;
        Name = "Text2"


    ADD OBJECT text3 AS textbox WITH ;
        Height = 23, ;
        Left = 370, ;
        Top = 67, ;
        Width = 100, ;
        Name = "Text3"


    PROCEDURE filltree
        LPARAMETERS lnParentKey
        LOCAL lnRecNo, oEmpty AS EMPTY
        oEmpty = NEWOBJECT([EMPTY])
        ADDPROPERTY(oEmpty,[NodeText]  ,[])
        ADDPROPERTY(oEmpty,[NodeKey]   ,0)
        ADDPROPERTY(oEmpty,[Something] ,[])
        IF VARTYPE(lnParentKey) == [L]
           thisform.myNodeProperties = NEWOBJECT([Collection])
           SEEK 0 IN crsTest
           SCAN WHILE Parent = 0
                lnRecNo  = RECNO()
                thisform.oleTree.Nodes.Add(,1,TRANSFORM(Key)+[_],Text)
                ADDPROPERTY(thisform.oleTree.Nodes(TRANSFORM(Key)+[_]),[NodeText],Text)
                thisform.FillTree(Key)
                GOTO lnRecNo
           ENDSCAN
        ELSE
           SEEK lnParentKey IN crsTest
           SCAN WHILE Parent = lnParentKey
                lnRecNo  = RECNO()
                oNode = thisform.oleTree.Nodes.Add(TRANSFORM(Parent)+[_],4,TRANSFORM(Key)+[_],Text)
                ADDPROPERTY(thisform.oleTree.Nodes(TRANSFORM(Key)+[_]),[NodeText],Text)
                thisform.FillTree(Key)
                GOTO lnRecNo
           ENDSCAN
        ENDIF
    ENDPROC


    PROCEDURE Load
        CREATE CURSOR crsTest (Key I, Parent I, Text varchar(100))
        INSERT INTO crsTest VALUES(1,0, 'root text')
        INSERT INTO crsTest VALUES(2,1, 'child text 1')
        INSERT INTO crsTest VALUES(3,1, 'child text 2')
        INSERT INTO crsTest VALUES(4,2, 'grandchild text 1')
        INDEX ON Parent TAG crsTest
    ENDPROC


    PROCEDURE Init
        thisform.FillTree()
    ENDPROC


    PROCEDURE oletree.NodeClick
        *** ActiveX Control Event ***
        LPARAMETERS node

        ******* BOOOM ******
        thisform.Text1.Value = node.NodeText
    ENDPROC


ENDDEFINE
*
*-- EndDefine: form1
**************************************************
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform