On Sat, 19 May 2007 05:56:53 -0700, perspolis <re*****@hotmail.comwrote:
Hi all
I'm looking for a Combobox that displays tree.
Does anyone has a source code for that???
I'm not aware of any example code you could use, and frankly it sounds
like an unreasonably different variation of a ComboBox to justify using
the ComboBox as a base. The list in a ComboBox is for picking an item
from a list of unique items to use for the single text value for the box.
On the other hand, one classic feature of a tree view is that you can have
the same item multiple times, uniquely distinguished by being in different
sections of the tree.
I think there are ways around this from a user-comprehension point of
view. For example, the value used when the user selects something from
the tree could be the aggregrate of not only the item the user selected,
but all of the parent nodes leading to that item. That way the text value
always corresponds exactly to a single item within the tree.
But even if you resolve that issue, since the base ComboBox doesn't draw
trees, you'd have to override all of the painting somehow and do the tree
yourself (and I admit, I haven't even looked closely at what you'd have to
do to override the painting...combo box controls are a little funny,
because they usually involve more than one actual control, and I assume
the .NET version is the same).
You may find it makes more sense to just use a TreeView control along with
a regular TextBox control. Handle the synchronization issues yourself,
which aren't very hard at all, and let the two controls do the hard work
of managing the visual aspect of the UI.
Pete