Public oForm oForm = Createobject("TVpgf") oForm.Show Define Class TVpgf As Form Height = 500 Width = 600 Add Object tree As OleControl With ; Left = 10, Top = 10,Width = 300,Height = 400,; OleClass = 'MSComCtlLib.TreeCtrl' Add Object pgf As PageFrame With ; PageCount=10, Tabs=.F., Left = 320, Top = 10,Height=400, Width = 200,; SpecialEffect=2,BorderWidth=0, ; Page1.Caption = "Sample Page",; Page5.Caption = "Sample Page%%Related Page",; Page4.Caption = "I'm not visible" Procedure Init With This.pgf For ix=1 To .PageCount .Pages(m.ix).AddObject("Dummy","Label") With .Pages(m.ix).Dummy .Caption = "This is page "+Transform(.Parent.PageOrder) .Top = 30 .Visible = .T. Endwith Endfor Local Array arrPages[.Pagecount,2] For ix=1 To .PageCount arrPages[ix,1] = '_'+Padl(.Pages(ix).PageOrder,3,'0') arrPages[ix,2] = .Pages(ix).Caption Endfor .SetAll('Backstyle',0,'Page') Endwith Asort(arrPages,2) #Define tvwFirst 0 #Define tvwLast 1 #Define tvwNext 2 #Define tvwPrevious 3 #Define tvwChild 4 With This.tree .linestyle =1 .labeledit =1 .indentation = 5 .PathSeparator = '\' .Scroll = .T. .OLEDragMode = 0 .OLEDropMode = 0 For ix = 1 To Alen(arrPages,1) If .F. && Invisible page - ie: arrPages[m.ix,2]=="I'm not visible" Loop Endif If At('%%',arrPages[ix,2]) > 0 lcNodeText = Substr(arrPages[ix,2],Rat('%%',arrPages[ix,2])+2) lcNodeID = arrPages[ix,1] lcParentText = Substr(arrPages[ix,2],1,Rat('%%',arrPages[ix,2])-1) lcParentID = arrPages[Asubscript(arrPages, Ascan(arrPages,lcParentText), 1),1] oNode = .nodes.Add(lcParentID,tvwChild,lcNodeID,lcNodeText) Else lcNodeText = arrPages[ix,2] lcNodeID = arrPages[ix,1] oNode = .nodes.Add(,tvwFirst,lcNodeID,lcNodeText) Endif oNode.Expanded = .T. Endfor .nodes( '_'+Padl(1,3,'0') ).Selected = .T. Endwith Endproc Procedure tree.NodeClick Lparameters Node Thisform.pgf.ActivePage = Val(Substr(Node.Key,2)) Endproc EnddefineCetin