Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Treeview or MShflexgrid
Message
From
06/12/2006 09:48:33
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
06/12/2006 08:53:01
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Environment versions
Visual FoxPro:
VFP 6 SP5
Miscellaneous
Thread ID:
01174842
Message ID:
01175201
Views:
12
#Define tvwFirst	0
#Define tvwLast	1
#Define tvwNext	2
#Define tvwPrevious	3
#Define tvwChild	4

CREATE CURSOR myForms (nodeID i, parentID i, nodeText c(20),formName c(10))
INSERT INTO myForms VALUES (1,0,"Root 1","")
INSERT INTO myForms VALUES (2,0,"Root 2","")

INSERT INTO myForms VALUES (4,1,"Root 1-C1","myForm1")
INSERT INTO myForms VALUES (5,1,"Root 1-C2","myForm2")
INSERT INTO myForms VALUES (6,1,"Root 1-C3","myForm3")

INSERT INTO myForms VALUES (7,2,"Root 2-C1","myForm21")
INSERT INTO myForms VALUES (8,2,"Root 2-C2","myForm22")
INSERT INTO myForms VALUES (9,2,"Root 2-C3","myForm23")

Public oForm
oForm = Createobject('myForm')
oForm.Show()

With oForm.Tree
  .Left = 10
  .Top = 10
  .Width = 200
  .Height = 200
  SELECT myForms
  SCAN
    IF parentID = 0
      .Nodes.Add(,tvwFirst,PADL(nodeID,3,'_'),NodeText)
    ELSE
      .Nodes.Add(PADL(parentID,3,'_'),tvwChild,PADL(nodeID,3,'_'),NodeText)
    ENDIF
  endscan
Endwith

Define Class myForm As Form
  oNode= .Null.
  Add Object Tree As OleControl With ;
    Name = 'Tree',OleClass='MSComCtlLib.TreeCtrl'

  Procedure Init
    With This.tree
      .linestyle = 1
      .Font.Name = 'Times New Roman'
      .Font.Size = 10
      .indentation = 5
    Endwith
  ENDPROC
  PROCEDURE Tree.NodeClick(oNode)
    SELECT myForms
    LOCATE FOR nodeID = VAL(chrtran(oNode.Key,'_',''))
    IF !EMPTY(myForms.FormName)
      IF FILE( FORCEEXT(myForms.FormName,'scx') )
        DO FORM (myForms.FormName)
      ELSE
        MESSAGEBOX( FORCEEXT(myForms.FormName,'scx') + " is missing." )
      ENDIF
    endif
  endproc
Enddefine
Cetin

>hi,
>i try as under , but how i can run it at node or child i can choices
>
>PROCEDURE click
>  With This.tree
>         .DO FORM myform
>    Endwith
>  Endproc
>
>>I didn't say with .Nodes.Click
>>NodeClick is an event of treeview.
>>Cetin
>>
>>>hi,
>>>thank you very much,
>>>about do form,
>>>main
>>>WITH .Nodes.click(do form myform)&& not work
>>>
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform