TreeView and Multiselect.

  • Thread starter Thread starter Vladimir Bezugliy
  • Start date Start date
V

Vladimir Bezugliy

I do not find properties Multiselect in the TreeView.
Can I in some way select several items at once?
 
Yes you can. Inherit your class from the treecontrol and add a new property
for Selections. Maintain an arraylist in your class for selected nodes. then
every time the user clicks on a node, depending on the Ctrl or Shift button
status, add the nodes into the arraylist. Expose this arraylist as
Selections from your tree control.

As far as the drawing of selected items is concerned, you will need to
override OnBeforeSelect and OnAfterSelect and do your painting work

Hope this helps,

--Saurabh
 
The "windows" way with a treeview is to use checkboxes. The control has a
"CheckBoxes" property. This gives great flexiblity without having to paint
the items yourself. You capture the BeforeCheck and AfterCheck events to
deal with the user's input (ie if you check a node that has child nodes do
you want to check all the child nodes??)

To determine the state after the fact you iterate thru the node and check
the "Checked" property.

Lloyd Sheen
s
 
Back
Top