oForm = Createobject('myForm') oForm.Show Read Events Define Class myForm As Form Height = 300 Width = 470 DoCreate=.T. Datasession=2 Add Object myTree As OleControl With ; Top = 0, ; Left = 0, ; Height = 300, ; Width = 200, ; Name = "myTree", ; OleClass = 'MSComCtlLib.TreeCtrl' Add Object myGrid As myGrid With ; Top = 0, ; Left = 220, ; Height = 300, ; Width = 250, ; Name = "myGrid" Procedure Load Create Cursor myTest (myID i, myType c(20)) For ix = 1 To 20 Insert Into myTest (myID) Values (ix) Endfor Locate Endproc Procedure myTree.Init #Define tvwFirst 0 #Define tvwLast 1 #Define tvwNext 2 #Define tvwPrevious 3 #Define tvwChild 4 With This .linestyle =1 .labeledit =1 .indentation = 5 .PathSeparator = '\' .Scroll = .T. .OLEDragMode = 1 For ix=1 To 3 .Nodes.Add(,tvwFirst,"root"+Ltrim(Str(ix)),'Main node '+Ltrim(Str(ix))) For jx=1 To 4 .Nodes.Add("root"+Ltrim(Str(ix)),tvwChild,; "child"+Ltrim(Str((ix-1)*4+jx)),; 'Child '+Ltrim(Str(jx))+' of '+Ltrim(Str(ix))) Endfor Endfor Endwith Endproc Procedure QueryUnload Clear Events Endproc Enddefine Define Class myGrid As Grid OLEDropMode = 1 Procedure OLEDragOver Lparameters oDataObject, nEffect, nButton, nShift, nXCoord, nYCoord, nState With This lnActiveRow = Ceiling( ; ( nYCoord - (.Top + .HeaderHeight) ) / .RowHeight ) .ActivateCell(lnActiveRow,2) Endwith Endproc Procedure OLEDragDrop Lparameters oDataObject, nEffect, nButton, nShift, nXCoord, nYCoord If oDataObject.GetFormat(1) With This .Columns(2).Text1.Value = oDataObject.GetData(1) Endwith Endif Endproc EnddefineCetin