Let's consider a node with index N, that has M children.

There are 4 possibilites when removing nodes( at last as exposed by the Lua
binding):

remove everything: clear lastaddnode as well
remove node N: clear lastaddnode if it was N.
remove node N and all its children: if lastaddnode < N, do nothing. clear
lastaddnode if it is in the range [N,N+M], else lastaddnode -= M+1
remove children of node N: if lastaddnode <= N, do nothing. clear
lastaddnode if it is in the range [N+1,N+M]. else lastaddnode -= M

Doesn't it catch every situation?

Now I agree that it it is better to use lastaddnode right after adding a
node. But then I like tidy things :-).


Regards,


Benoit.


2012/7/12 Antonio Scuri <[email protected]>

>  Hi,****
>
> ** **
>
>  What I can do to improve that is to check is the node being removed is
> the last added node, and then clear that value. And to also clear that
> value when all nodes are removed. But I don’t know if I will catch all
> situations. The idea behind the last added node is for it to be used right
> after the node was added.****
>
> ** **
>
> Best,****
>
> Scuri****
>
> ** **
>
> *From:* Benoit Germain [mailto:[email protected]]
> *Sent:* terça-feira, 10 de julho de 2012 05:22
> *To:* IUP discussion list
> *Subject:* [Iup-users] [IUP 3.6 Windows 7] IupTree DELNODE and LASTADDNODE
> ****
>
> ** **
>
> Hello,
>
> When I have a tree that contains some nodes and I delete them with
> tree.delnode = "ALL", I notice that tree.lastaddnode still contains some
> non-nil value though it is no longer relevant. When nodes are removed in a
> way that affects the id of the last added node, shouldn't tree.lastaddnode
> be updated to the correct id if the node still exists, and set to nil when
> the node itself is removed?
>
> Regards,
>
> --
> Benoit.****
>
>
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Iup-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to