Hi David,
I'm sorry I didn't go into the advanced treeview issues when I was doing
the
scripting tutorials; looks like I only covered the basics. I'll try to
put
together another tutorial to cover all the advanced treeview issues, and
answer your questions as best as I can for now:
1. What is the exact benefit of the Text, as compared to the Data, field
in a treeview item.
As you suspect, the data property is only there for your convenience.
Sometimes, when creating the text, there is some record in a dictionary
associated with the text, and sometimes you could store the key to it in
the
data property, thus saving you the trouble of having to look up the text
to
figure that out. If some of your items are one type of thing, and some
the
other, then the data property is also quick and easy to use for enabling
or
disabling other controls as various treeview items are highlighted (it's a
lot quicker to just examine the data item when a treeview item is
highlighted than it is to look up the text somewhere to figure that out).
2. The treeview I am building, has checkboxes, which the user can check
for each item on the tree. I have searched the Reference manual, but not
sure if I have overlooked anything. From what I can see, there is no way
in
>determining whether a treeview Item has been checked or not. I see the
Selected feature, but from what my testing leads me to understand, this
simply let's me know when an item has focus (that is, when the cursor is
[>]
placed on the item, the Selected feature will be set).
Actually, the treeview control object itself does have a selected
property
which does what you say: it returns the treeviewItem object which is
currently highlighted. The treeviewItem object however however has a
checked property (if you're using checkboxes), or a selected property if
not, and they return an indication as to whether that particular item is
either checked or selected.
>Is it correct, that there is no build-in feature, that would "fire",
>when
a treeview item has been checked or unchecked?
I'm sure some event happens; it looks to me like it is the treeviewClicked
event which would happen, but there's also a treeviewSelectionChange
event
which could be it (it's not always clear when they speak of selection
whether they mean a multi-selection control is having one of its items
selected or unselected, or if they mean the focused/highlighted item is
changing).
[>] >3. Does anyone have a simple quick iteration routine, for "rushing"
through a whole treeview, including all its branches and leaves. My
treeview, might hold as much as 9 sublevels, in addition to the root. And
it
might hold [>] >different amounts of entries on each branch or sublevel. I
guess the best would be to use some For...Next loops, and somehow retrieve
the Count property for each branch. But I have run my head into the wall,
as
to how to get [>] >through absolutely all the possible items on the tree.
I
guess, that is the one way to go, when iterating the different items, or
am
I totally lost in such an approach? Say for instance, the user would have
been given the chance [>] >of searching for a given text, which would be
the
Text property of an item on the tree. I then guess, I will have to iterate
all the current items on the tree, looking out for that particular text.
And, that is why, I wondered if there [>] >was a simple routine, that
would
perform such a "run-through", with relatively few lines of coding.
I don't have one handy, and you're right that you will have to do this for
a
search. It is possible to go to app central (the web version), go to the
appGet app, and get an older version (there's a link to let you see
earlier
versions of an app). Before they began encrypting it, appGet was
available
in the clear, and it uses a treeview control, and it has a "find" feature,
so it must work through the treeview as you are wanting to do.
[>]
When you download it, to save you from having to install it to get to the
source code, you can change the file extension from .wepm to .cab, then
you
can use some unpack utility (such as winRar), which will unpack it into a
directory.