I can't for the life of me get a TTreeView to multi-select the child nodes of a selected parent. I'm attempting to select only top level children of an expanded node so there is no recursion. I've tried all three of the "Select" methods, in both the TList and the array of TTreeNode overload methods I get an AV when using the select(Nodes) method. When I use the single node method with a ShiftState of ssCtrl I don't get the AV, I see the nodes getting selected (in a flash) and when done there is nothing selected and the SelectionCount is 0.

I can't for the life of me get a TTreeView to multi-select the child nodes of a selected parent. I'm attempting to select only top level children of an expanded node so there is no recursion. I've tried all three of the "Select" methods, in both the TList and the array of TTreeNode overload methods I get an AV when using the select(Nodes) method. When I use the single node method with a ShiftState of ssCtrl I don't get the AV, I see the nodes getting selected (in a flash) and when done there is nothing selected and the SelectionCount is 0.

I'm trying to do this in the OnClick event.

Any ideas on what's going on?  (XE8)

Comments

  1. Well it hardly ever fails - after asking, then continued hacking away at it I get it working. I needed to set each node "selected" then perform the treeview.select(node, [ssCtrl]) and for one reason or another wrap it in a try...except block

    ReplyDelete
  2. try/except doesn't sound right at all

    ReplyDelete
  3. Yeah, it didn't seem right to me either - further hacking is required.

    ReplyDelete
  4. I'm not sure hacking is really the way forward

    ReplyDelete
  5. :) unfortunately with my skill level that's what is available to me.

    ReplyDelete

Post a Comment