260 likes | 634 Views
Using TreeView ActiveX Control in VFP. Venelina Jordanova JEI Varna, Bulgaria. Who am I ?. Master degree in CS from TU of Varna MCP FoxPro developer since v 2.0 Developer of various different information systems Speaker at Frankfurt Devcon 2003 and 2004, Prague 2004 and 2005 and
E N D
Using TreeView ActiveX Control in VFP Venelina Jordanova JEI Varna, Bulgaria Data access techniques using CursorAdapter class
Who am I ? • Master degree in CS from TU of Varna • MCP • FoxPro developer since v 2.0 • Developer of various different information systems • Speaker at Frankfurt Devcon 2003 and 2004, Prague 2004 and 2005 and Microsoft Developers Day-Varna 2005 • Owner of JEI - Varna, Bulgaria Outsourcing center venelina@mnet.bg Data access techniques using CursorAdapter class
Overview • What can we do with TreeView ActiveX Control • hierarchical data • card-index • organization trees • drill-down organized information • not data-bound control • programming • delayed loading • drag-drop Data access techniques using CursorAdapter class
Adding a TreeView ActiveX control to a form • ActiveX controls selection in VFP Options dialog • Form Controls toolbar • Control specific property sheet • Help file - cmctl198.chm Data access techniques using CursorAdapter class
TreeView ActiveX control properties, events and methods • Objects you work with: • TreeView control • Nodes collection • Node objects • ActiveX controls are part of an OLE Container control • Use the container's Object property Thisform.oTreeView.Object.Indentation = 10 Data access techniques using CursorAdapter class
Style MousePointer LineStyle LabelEdit ImageList .oTreeView.Object. ImageList =.oImageList.Object BorderStyle, Appearance, OLEDragMode and OLEDragMode known from VFP Indentation PathSeparator HideSelection Sorted FullRowSelect Checkboxes SingleSel Scroll HotTracking TreeView Control Properties • TreeView Control Property sheet Data access techniques using CursorAdapter class
TreeView Control Properties • Fontpage • Font object • Picturepage • Custom Mouse pointer Data access techniques using CursorAdapter class
TreeView Control Properties • Properties, not listed in property sheet: • DropHighlight • Nodes • SelectedItem Data access techniques using CursorAdapter class
TreeView Control Methods and Events • BeforeLabelEdit, AfterLabelEdit • Collapse, Expand • GetVisibleCount • HitTest • use GetDeviceCaps API function for TWIPS-to-Pixels conversion • NodeCheck • NodeClick • StartLabelEdit Data access techniques using CursorAdapter class
Nodes Collection Properties • Count • Item(<Index>) Data access techniques using CursorAdapter class
Nodes Collection Methods • Add <Object>.Nodes.Add(Relative, Relationship, Key, Text, Image, SelectedImage) • Relationship: • 0 - First • 1 - Last • 2 - (Default) Next • 3 - Previous • 4 - Child • Clear • Remove Data access techniques using CursorAdapter class
Node Object Properties • Children • Expanded • FullPath • Image, ExpandedImage, and SelectedImage • Key • Child, FirstSibling, LastSibling, Previous, Parent, Next, and Root • Selected • Text Data access techniques using CursorAdapter class
Node Object Methods • CreateDragImage • EnsureVisible Data access techniques using CursorAdapter class
Programming the TreeView control • SYS(2333) • _VFP.AutoYield • use the Object property Data access techniques using CursorAdapter class
Load data in TreeView control • Initializing ImageList property • Preparing data to be load • Loading nodes • Image indexes • Key expressions • Code to position to the data record • Demo – OrdersByMonth form Data access techniques using CursorAdapter class
Delayed data loading • Performance considerations • Specifics: • load nodes only for root level records • add a dummy node, to show there is drill down information • Code in Expand event • Demo - OrdersByMonth_DelayedLoading form Data access techniques using CursorAdapter class
Loading data from self-related tables • Recursive nodes loading • Demo – Employees form • cursor, containing only high level employees (root level nodes) • reentrant method BuildEmployeeSubtree Data access techniques using CursorAdapter class
Drag & Drop in TreeView control • Control settings • OLEDragMode • OLEDropMode Data access techniques using CursorAdapter class
DataObject object DataObject object methods SetFormat SetData ClearData GetFormat GetData OLEStartDrag OLEDragOver nEffect OLEDragDrop Drag & Drop in TreeView control • Events handling Data access techniques using CursorAdapter class
Let’s do it • Demo – Drag & Drop in Employees form • Operation start • OLEDragOver event • DropHighlight property • Finish Drag & Drop operation • OLEDragDrop event • MoveEmployeeToTopLevel method • Change data record Data access techniques using CursorAdapter class
Deploying • Deploying applications using TreeView ActiveX control • MSComCtl.ocx. • Microsoft Windows Common Controls (6.0) merge module Data access techniques using CursorAdapter class
Resources • Help file - cmctl198.chm • http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fox7help/html/lngactivex_controls_overview.asp • http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon98/html/vbconusingtreeviewcontrol.asp • http://www.microsoft.com/downloads/details.aspx?familyid=0746596E-3778-425A-BF0F-0C3A9023ED29&displaylang=en Data access techniques using CursorAdapter class
Thank you! Please remember to fill out your evaluation. Data access techniques using CursorAdapter class