unselecting a tree node

Started by jb, February 16, 2010, 11:42:38 AM

Previous topic - Next topic

jb

Can't see a way to do this.  I need to unselect all tree nodes before clearing the tree.  If a node is selected, it throws an error I guess during the onSelected event. 

But that's another story: I can't see how the SelectItem function can be used to "select nothing" - like by passing nil.

Thanks for any help.
James Buzbee
Managing Memeber
Black Horse Development, LLC

Fred Tomke

Hi, I can remember that I had the same problem: when the clear method will be executed it seems that the current selection is jumping from one item to the next item.

The only advise I can give you for the meantime is to clear the OnSelChanged event at runtime:

Code (autolisp) Select

(setq strOldEvent (dcl_Control_GetProperty MyProj_MyForm_MyTree "SelChanged"))
(dcl_Control_SetProperty MyProj_MyForm_MyTree "SelChanged" "")
(dcl_Tree_Clear MyProj_MyForm_MyTree)
(dcl_Control_SetProperty MyProj_MyForm_MyTree "SelChanged" strOldEvent)


Maybe it would be good to add this as a new feature request. Because I could need this, too. Would you be so kind to add this there?

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

owenwengerd

Are you saying that the SelChanged event firing multiple times during the call to Clear?  If so, I would call that a bug.

jb

QuoteAre you saying that the SelChanged event firing multiple times during the call to Clear?
it would appear so.  Most controls have a way of "deslecting" or passing nil to deselect an item.  The tree control doesn't seedm to have that option.  Could we just have the option of passing "nil" to the selectItem method for having no node selected?  Or, if you want to handle the apparent bug differently, that would work too.

Fred, thanks - I'll have a look.

Owen: thanks, for well, everything!!
James Buzbee
Managing Memeber
Black Horse Development, LLC

owenwengerd

I did a quick test, and in my test the OnSelChanged event did not fire during Tree_Clear.  I think the inability to remove the selection was an oversight, and I have now changed the code so that passing a handle of NIL removes the selection.

jb

James Buzbee
Managing Memeber
Black Horse Development, LLC