473,880 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

[noobie] TreeView AfterSelect event

I have a TreeView object that I'm filling in with the directory
structure. However, for the sake of this learning exercise, I
am making it flat. So that when a user clicks on the directory
name, I refresh the TreeView with the contents of the new
directory. All that is more or less working.
What I've noticed is that if I select node X, when I Clear()
the nodes and go to refresh with the contents of the new
directory, the AfterSelect event (or, at least, my AfterSelect
event method) is triggered for node X-1 through node 0 in
turn. Why is that? How can I make it so that the event is
triggered only once and only when a node is clicked?

thnx,
Chris
Nov 16 '05 #1
3 5604
Hi, Christoph

This is by design. So, you have to check if node is selected (or clicked as
you say) in your AfterSelect handler and act accordingly.
You might want to experiment also with BeginUpdate/EndUpdate calls around
your tree filling code.

HTH
Alex

"Christoph Boget" <jc*****@yahoo. com> wrote in message
news:Ow******** ******@TK2MSFTN GP09.phx.gbl...
I have a TreeView object that I'm filling in with the directory
structure. However, for the sake of this learning exercise, I
am making it flat. So that when a user clicks on the directory
name, I refresh the TreeView with the contents of the new
directory. All that is more or less working.
What I've noticed is that if I select node X, when I Clear()
the nodes and go to refresh with the contents of the new
directory, the AfterSelect event (or, at least, my AfterSelect
event method) is triggered for node X-1 through node 0 in
turn. Why is that? How can I make it so that the event is
triggered only once and only when a node is clicked?

thnx,
Chris

Nov 16 '05 #2
> This is by design. So, you have to check if node is selected (or clicked
as
you say) in your AfterSelect handler and act accordingly.
You might want to experiment also with BeginUpdate/EndUpdate calls around
your tree filling code.


I'm checking to see if the node is selected/clicked but it seems as if every
time the AfterSelect handler is executed, every node that is passed to it is
set as selected whether or not it's the one I actually clicked on.
You can see my code here:

http://www.geocities.com/jcboget/MView.html

If you copy and paste it to run yourself, just remove the "<pre>" tags
(obviously). Also, I have it so that my tabs are set to "2 spaces".
Finally,
as you are looking at the code, please keep in mind that I am a relative
newbie at windows programming. I may not be doing things as efficiently
as possible. I'm writing this app as a learning process. And as for the
TreeView control, I'm intentionally using it to display the directory
structures
flat.

In any case, back to my problem: why is it that the AfterSelect handler is
working with every node and why does it think that every node has been
selected?

thnx,
Christoph
Nov 16 '05 #3
> This is by design. So, you have to check if node is selected (or clicked
as
you say) in your AfterSelect handler and act accordingly.
You might want to experiment also with BeginUpdate/EndUpdate calls around
your tree filling code.


I'm checking to see if the node is selected/clicked but it seems as if every
time the AfterSelect handler is executed, every node that is passed to it is
set as selected whether or not it's the one I actually clicked on.
You can see my code here:

http://www.geocities.com/jcboget/MView.html

If you copy and paste it to run yourself, just remove the "<pre>" tags
(obviously). Also, I have it so that my tabs are set to "2 spaces".
Finally,
as you are looking at the code, please keep in mind that I am a relative
newbie at windows programming. I may not be doing things as efficiently
as possible. I'm writing this app as a learning process. And as for the
TreeView control, I'm intentionally using it to display the directory
structures
flat.

In any case, back to my problem: why is it that the AfterSelect handler is
working with every node and why does it think that every node has been
selected?

thnx,
Christoph

Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3070
by: Sreepathi Rao Konchada | last post by:
Hi, Is there any way that we can find the previously selected Treeview node details. I mean is there any build in function available to find the previously selected node of the Treeview in VB.NET. Thanks, Sreepathi Rao.
0
1235
by: Mehdi Mousavi | last post by:
Hi folks, I've got a real damn problem using the AfterSelect event of the TreeView control where the handler of the above mentioned event will be *re-entered* before leaving the procedure. I need to know what the problem might be and how can I force synchronous calls to be made when the AfterSelect event occurs. Thank you for your time, Mehdi
3
11638
by: vijaynats | last post by:
I have a treeview with a ContextMenu attached. When i click on a node, AfterSelect fires but does not fire when right clicked (the context menu pops up). (Background: I have loaded a list of disk file names onto the tree and have to open the file thru the contextmenu for editing. It opens the file whose treeview node was selected earlier using a left mouse click). Any solutions?
6
6734
by: Tim | last post by:
Hi I have a form with a treeview on it. When I select a particular node it adds/shows a tab on the form. The treeview node remains selected as it should. The user can close the tab or remove the focus to another tab. Clicking on the same already selected node should add/show the tab, however the after select event does not fire as the node is already selected. I trapped the click event of the treeview but that is not node specific. In...
0
1785
by: Treeview Trouble | last post by:
I have an application where there are two radio buttons each of which populates a treeview control with a directory structure. Each radio button corresponds to a different directory which may or may not have some subdirectories with the same name. I am not having any problems populating the treeview with the corresponding directory structure when switching between radio buttons. In the treeview's AfterSelect event, I take the path from...
1
6383
by: mongphong28 | last post by:
Hi, I'm using a treeview as a menu, and when the user clicks on a node I want the focus to set to a control (ie textbox) in a panel to the right. The problem I'm having is the focus will not stay on the control, but instead jumps back to the treeview. I'm setting the focus in the AfterSelect event of the treeview, and if I step through the code the desired control does have .Focused = True after I have set it, but then somewhere after...
9
6136
by: auntiejack56 | last post by:
Hi, I've got a treeview, and I want to display the node text property that I have a) clicked on or b) highlighted using the up or down arrows
2
2194
by: =?Utf-8?B?anAybXNmdA==?= | last post by:
My first time using a TreeView: I've got a TreeView that I populated with some data and it has nodes. In the Properties window, I created an Event Handler for the TreeView's AfterSelect method, and it allows me to determine what Tree Node has been selected. However, if I expand the TreeView and select one of the Child TreeNodes, they do not trigger this event.
2
4408
by: govolsbaby | last post by:
Hi All I've got a treeview with checkboxes. I want the user to be able to toggle the checkbox by click on the checkbox OR by clicking on the node text. So I've added an afterselect event handler to get the selected node and change the .Checked property of the selected node as appropriate, which works to change the .Checked status when the user FIRST clicks on the text of a particular node.
0
9925
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9772
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10713
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10809
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10395
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9550
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7948
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7104
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5777
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.