>>thisform.oTree.SelectedItem = thisform.oTree.Nodes("_RT"+tran(x3)) >>>
PUBLIC oform1 oform1=NEWOBJECT("form1") oform1.Show RETURN ************************************************** *-- Form: form1 (c:\traff\test.scx) *-- ParentClass: form *-- BaseClass: form *-- Time Stamp: 06/02/05 09:07:02 PM * DEFINE CLASS form1 AS form Top = 0 Left = 0 Height = 701 Width = 375 DoCreate = .T. Caption = "Form1" Name = "Form1" oldforecolor = .F. oldbackcolor = .F. ADD OBJECT command1 AS commandbutton WITH ; Top = 90, ; Left = 273, ; Height = 27, ; Width = 84, ; Caption = "Command1", ; Name = "Command1" ADD OBJECT olecontrol1 AS olecontrol WITH ; OleClass = "MSComctlLib.TreeCtrl.2" ,; Top = 16, ; Left = 10, ; Height = 576, ; Width = 207, ; Name = "Olecontrol1" PROCEDURE Init oNode = thisform.olecontrol1.Nodes.add(,1,"root_","Root") thisform.oldbackcolor = oNode.BackColor thisform.oldforecolor = oNode.ForeColor FOR nTest = 1 TO 50 thisform.olecontrol1.Nodes.Add("root_", 4, TRANSFORM(nTest)+"_" , "Node "+TRANSFORM(nTest)) NEXT thisform.olecontrol1.Nodes("root_").Expanded = .t. thisform.olecontrol1.SelectedItem = oNode thisform.olecontrol1.SetFocus() ENDPROC PROCEDURE olecontrol1.GotFocus this.HideSelection = .f. IF NOT ISNULL(this.SelectedItem) this.SelectedItem.BackColor = thisform.oldbackcolor this.SelectedItem.ForeColor = thisform.oldforecolor ENDIF ENDPROC PROCEDURE olecontrol1.LostFocus this.HideSelection = .t. IF NOT ISNULL(this.SelectedItem) thisform.oldbackcolor = this.SelectedItem.BackColor thisform.oldforecolor = this.SelectedItem.ForeColor this.SelectedItem.BackColor = RGB(255,0,0) this.SelectedItem.ForeColor = RGB(255,255,255) ENDIF ENDPROC ENDDEFINE * *-- EndDefine: form1 **************************************************