473,569 Members | 2,991 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Please Help Me Understand This Bizarre Tree Entry Observation

Tom
My older system: Win2k, VS2005(Academic ), .Net 2.0 SP1.

Windows.Forms Application: Two splitter panels, a TreeView (named:
"tree") in one panel populated with directory name nodes.

Logic for programmaticall y selecting a previously saved FullPath is
being called from the tree.Enter() event handler;

After expanding to a specific folder and selecting it (for testing
purposes I chose a specific folder that is level 4 depth) ... I
observe a difference between tabbing into the tree control and mouse
clicking into it. I have placed the following line at the beginning of
the Enter event handler:

Console.Writeli ne("tree.Select edNode = {0}", tree.SelectedNo de);

----------------------------------------------------
The problem >>>

When I tab into the tree control, above line output is:

tree.SelectedNo de =

When I click into the tree control, the output is:

tree.SelectedNo de = TreeNode: G:\

----------------------------------------------------
The "G" drive is correct for the folder selected. This subtle little
SelectedNode value difference is wreaking havoc on my code that
programmaticall y selects a previously saved folder location.

I've tried a variety of guesses aimed at gaining some control and
understanding of what is going on ... but all of them are failures and
discussing them only confuses the issue. :(

I might eventually stumble onto a novice programmer level solution ...
but I'd be so much better off understanding what is going on and how
to properly control the property settings of the TreeView object.

Specific guidance to the above problem would be wonderful !!

Additional TreeView advice or example code on programmatic selection
would be equally appreciated. Suggested texts, links, etc. I'm not
lazy ... but perhaps as evidenced from the hours I've spent searching
and the days of confusion this has caused me it is fair to say I'm not
exactly "gifted". ;)

** Thanks in advance for any help !! **

-- Tom

Mar 6 '08 #1
2 1317
On Thu, 06 Mar 2008 14:25:16 -0800, Tom <Th********@ear thlink.netwrote :
[...] I have placed the following line at the beginning of
the Enter event handler:

Console.Writeli ne("tree.Select edNode = {0}", tree.SelectedNo de);

----------------------------------------------------
The problem >>>

When I tab into the tree control, above line output is:

tree.SelectedNo de =

When I click into the tree control, the output is:

tree.SelectedNo de = TreeNode: G:\

----------------------------------------------------
The "G" drive is correct for the folder selected. This subtle little
SelectedNode value difference is wreaking havoc on my code that
programmaticall y selects a previously saved folder location.
Well, when you tab into the control, is there actually a node selected?
Or is there simply a focus rectangle around one of the nodes?

I would expect the SelectedNode property to be a reliable source of
information regarding what's selected, if anything. So if it's not
returning a node, it seems likely that no node is selected at that moment.

Barring that, you should post a concise-but-complete code sample that
reliably demonstrates the problem you're having.

Pete
Mar 6 '08 #2
Tom
Thanks Pete !

I will try to explore if somewhere in my other event handlers within
this project if somehow the SelectedNode becomes null. At this time
there is no concise way for me to duplicate the observation ... but I
will try. The observed problem is in a project that has grown to a few
thousand lines of code and there are a lot of interactions between the
panels.

Searching for the precise location where the SelectedNode becomes null
will hopefully reveal some additional insights into the combination of
events that I am trying to coordinate. I suffered immensely from using
too many events early on and have been trying to reduce the calling of
events as much as possible. Typical rookie mistake perhaps. Observe
something not behaving correctly, don't understand it, search through
the lists of events for something to cure the symptom ... all the
while not recognizing and treating the cause.

I've caught a few of my TreeView populating mistakes by writing out
detailed Nodes[].Name tables. I wish the texts I've read concentrated
more on troubleshooting rather than presenting a minimalist
pedagogical and well polished example. But then ... would the readers
appreciate it? Or the publishers print it?

Your comment has me re-energized and thinking again.

Thanks !!

-- Tom
Mar 6 '08 #3

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

Similar topics

4
1603
by: bob_yohan | last post by:
Hi all, I am rather new to database design and modelling concepts in general and was hoping for some advice on a problem I am trying to solve. I have designed a piece of software that creates a tree with pluggable nodes. Each node class can have 0 to n distinct classes plugged into it to define the type for that node. For example, a...
15
5074
by: Foodbank | last post by:
Hi all, I'm trying to do a binary search and collect some stats from a text file in order to compare the processing times of this program (binary searching) versus an old program using linked lists. I'm totally new to binary searches by the way. Can anyone help me with the commented sections below? Much of the code such as functions and...
1
9607
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej and I was wondering if anyone here would be able to give me some tips for young players such as myself, for learning the language. Is this the...
66
5315
by: genestarwing | last post by:
QUESTION: Write a program that opens and read a text file and records how many times each word occurs in the file. Use a binary search tree modified to store both a word and the number of times it occurs. After the program has read the file, it should offer a menu with three choices. the first is to list all the words along with the number of...
1
2540
by: Sorin Schwimmer | last post by:
Hi, I tried for the first time a Tix Tree, so, if my question is naive, I apologize upfront. The following code: <code> from Tix import * r=Tk()
4
3885
by: mathon | last post by:
Hello, im currently implementing a binary search tree means, that a greater number than root will be added as right child and a less number as left child. My insert function looks currently like this: template <class Item> void bag<Item>::insert(const Item& entry) // Header file used: bintree.h
9
6529
by: ckfan.painter | last post by:
I've run into a seemingly bizarre problem with insert() for std::vector. (This was done on Microsoft Visual C++ 2005 express version 8...maybe it is a compiler specific bug?) Here's the code: //=================== // vector tester 3.cpp : main project file.
1
2522
by: jodleren | last post by:
Hello! I need a tree (of folders), can anyone give me some ideas/input, how do I control collapse, explode etc? Showing the entire tree will be too much, so I need to show a part of it only.... BR Sonnich
3
3213
by: Travis | last post by:
I've created a custom Tree template. The tree mimics a menu tree and has the following properties. - nodes are identified by a unique name - any node can have infinite child nodes - nodes are not sorted so traversal is breadth first looking for the key - nodes are inserted by identifying the desired parent This works out well once the...
0
7703
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...
0
7926
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8138
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...
1
7679
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...
0
6287
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...
0
5223
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...
0
3647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2117
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1228
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.