Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Drag and drop in Treeview
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Versions des environnements
Visual FoxPro:
VFP 9
Database:
Visual FoxPro
Divers
Thread ID:
01019044
Message ID:
01020053
Vues:
34
You can look at the underlying code on the RIO. When I began to learn all I had were the VB samples in Help and Doug Henig. Now we have auto complete that exposes the object tree - AND YOU CAN BUILD TREEVIEWS ON A FORM RIGHT FROM COMMAND WINDOW.
It's a lot easier now - but still requires some intimate practice time.
Heres a command window treeview:
* Demo Treeview (from scratch) through VFP Command Window
* CREATE the form
ofoo=CREATEOBJECT('form')
ofoo.show
* Add the Image List
ofoo.addobject('ocxImageList','Olecontrol','MSComctlLib.ImageListCtrl.2')
oIL=ofoo.ocxImageList
oIL.imageheight=16
oIL.imagewidth=16
oIL.ListImages.Add(1,"CLOSED",LOADPICTURE("CLOSED.ICO"))
oIL.ListImages.Add(1,"OPENED",LOADPICTURE("OPENED.ICO"))
oIL.ListImages.Add(1,"ON",LOADPICTURE("ON.ICO"))
oIL.ListImages.Add(1,"OFF",LOADPICTURE("OFF.ICO"))
* Add the tree view
ofoo.addobject('ocxTreeView','Olecontrol','MSComctlLib.TreeCtrl.2')
oTV=ofoo.ocxTreeview
oTV.Visible=.t.
oTV.Height=ofoo.Height
oTV.Width=ofoo.Width
oTV.Style= 7  && tvwTreelinesPlusMinusPictureText
oTV.Fullrowselect=.t.
* Assign the imagelist as the treeview's imagelist 
oTV.ImageList=oIL
* These are some sample DBFs I used - dept.dbf supplied parent nodes
SELECT dept
GO top
oTV.Nodes.Add(,1,dept.dept_key,dept.dept_name,"CLOSED","OPENED")
SKIP
* .... empl.dbf supplied the children for the paren nodes.
SELECT empl
GO top
oTV.Nodes.Add(empl.dept_key,4,empl.dept_key+empl.empl_key,empl.empl_name,"OFF","ON")
SKIP
Learning from command window is a pleasure reserved only for VFP!. It's also a good approach when debugging, or shopping for design ideas or workarounds.
Imagination is more important than knowledge
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform