473,387 Members | 1,541 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 programmatically 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.Writeline("tree.SelectedNode = {0}", tree.SelectedNode);

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

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

tree.SelectedNode =

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

tree.SelectedNode = TreeNode: G:\

----------------------------------------------------
The "G" drive is correct for the folder selected. This subtle little
SelectedNode value difference is wreaking havoc on my code that
programmatically 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 1309
On Thu, 06 Mar 2008 14:25:16 -0800, Tom <Th********@earthlink.netwrote:
[...] I have placed the following line at the beginning of
the Enter event handler:

Console.Writeline("tree.SelectedNode = {0}", tree.SelectedNode);

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

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

tree.SelectedNode =

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

tree.SelectedNode = TreeNode: G:\

----------------------------------------------------
The "G" drive is correct for the folder selected. This subtle little
SelectedNode value difference is wreaking havoc on my code that
programmatically 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
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...
15
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...
1
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...
66
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...
1
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
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...
9
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: ...
1
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...
3
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...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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,...
0
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...

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.