TTreeView MultiSelect

Hi;

I turn MultiSelection property of tree view component to True.
Then inside the code, I want to make some of the nodes selected at the same time. How can i do it?

The following does not work:

[code]
MyNodes[0].Selected := True;
MyNodes[5].Selected := True;
MyNodes[11].Selected := True;
[/code]

Thanx...

Comments

  • : I turn MultiSelection property of tree view component to True.
    : Then inside the code, I want to make some of the nodes selected at
    : the same time. How can i do it?
    :
    : The following does not work:
    :
    : [code]
    : MyNodes[0].Selected := True;
    : MyNodes[5].Selected := True;
    : MyNodes[11].Selected := True;
    : [/code]

    .Selected is the currently highlighted node. IIRC the property is SelectedItems, which is an array of selected nodes.
  • : : I turn MultiSelection property of tree view component to True.
    Thanx. But i have one more question:

    when selecting nodes on the treeview using Ctrl, onchange event occurs. But when
    i deselect one of the selected nodes, this event does not occur.

    How can i detect such changes?

    (after both selection and deselection)

    Thanx..


    : : Then inside the code, I want to make some of the nodes selected at
    : : the same time. How can i do it?
    : :
    : : The following does not work:
    : :
    : : [code]
    : : MyNodes[0].Selected := True;
    : : MyNodes[5].Selected := True;
    : : MyNodes[11].Selected := True;
    : : [/code]
    :
    : .Selected is the currently highlighted node. IIRC the property is SelectedItems, which is an array of selected nodes.
    :

  • : : : I turn MultiSelection property of tree view component to True.
    : Thanx. But i have one more question:
    :
    : when selecting nodes on the treeview using Ctrl, onchange event occurs. But when
    : i deselect one of the selected nodes, this event does not occur.
    :
    : How can i detect such changes?
    :
    : (after both selection and deselection)

    The best way would be to write a procedure which changes the selection for a specific index, instead of editing the selecteditems array directly. This procedure can then also call the OnChange event for that node.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories