OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: jb on February 16, 2010, 11:42:38 AM

Title: unselecting a tree node
Post by: jb on February 16, 2010, 11:42:38 AM
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.
Title: Re: unselecting a tree node
Post by: Fred Tomke on February 16, 2010, 12:10:23 PM
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
Title: Re: unselecting a tree node
Post by: owenwengerd on February 16, 2010, 03:04:07 PM
Are you saying that the SelChanged event firing multiple times during the call to Clear?  If so, I would call that a bug.
Title: Re: unselecting a tree node
Post by: jb on February 16, 2010, 05:02:39 PM
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!!
Title: Re: unselecting a tree node
Post by: owenwengerd on February 16, 2010, 05:49:26 PM
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.
Title: Re: unselecting a tree node
Post by: jb on February 17, 2010, 04:05:40 AM
Thanks Owen.


You da Man!