Print Page | Close Window

TreeView Nodes Problem!!

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Controls
Forum Description: Topics Related to Codejock Controls
URL: http://forum.codejock.com/forum_posts.asp?TID=10664
Printed Date: 09 May 2024 at 7:21pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: TreeView Nodes Problem!!
Posted By: ViperSnake
Subject: TreeView Nodes Problem!!
Date Posted: 17 May 2008 at 2:47pm
I'm having a problem using the treeview control present on the Xtreme Suite Controls ActiveX Control v11.2.

When I select a node using the node_click event to open a form, the program always opens the first and the last nodes on the treeview.

So when I click to open a form, the program opens that form and two other more, that are related to the first and last nodes on the treeview.

Here is the code:

Private Sub Form_Load()
    Set treeTest.Icons = ImageManager.Icons

    treeTest.Nodes.Add , , , "Test1", 1
    treeTest.Nodes.Add , , , "Test2", 2
    treeTest.Nodes.Add , , , "Test3", 3
End Sub


Private Sub treeTest_NodeClick(ByVal Node As XtremeSuiteControls.TreeViewNode)

      Select Case Node.Index
        Case "1":
                frm1.Show
        Case "2": frm2.Show
        Case "3": frm3.Show
    End Select
End Sub

Am I doing this the right way? This code works fine with vb treeview...
 
Tks...




Replies:
Posted By: Aaron
Date Posted: 18 May 2008 at 1:15am
Hi,
 
There nothing wrong with your code. The Node.Index is long but that won't make a difference.
 
Only:
When you click the treeview it will get the focus and a treeview item will be selected > NodeClick event will fire.
 
If you would click the second node (when the treeview hasn't got the focus yet) the treeview gets the focus and first node will be selected (Nodeclick event fires and frm1 will be loaded) after this the click on node 2 or 3 will trigger another NodeClick event.
 
Try to add a dummy node first (this will have index 1) and change the cases in the NodeClick event and try again or run in debug mode you can see what I explained.
 
 
 


-------------
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....


Posted By: ViperSnake
Date Posted: 18 May 2008 at 7:23am
Tks for the help...I ended up solving the problem by giving focus to the treeview on the node click event!


Tks again..



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net