Hi,

 

  I just fixed the following problem:

 

Fixed: first item in single selection IupTree was not showing that it is selected.

 

  This may have lead you to think that the node was not selected. Actually the SELECTED_CB callback is not being called because the node was already selected.

 

  After understanding a little more of what you were trying to accomplish I can say now that the SELECTED_CB callback is not the recommended way of dynamic filling the braches of a tree.

 

  You should use the BRANCHOPEN_CB callback. But that callback will not be called if there is no children on the branch. So you will also need to add a dummy item that will be removed once you actually fill the branch. This also solves another problem of your script that shows the unfilled branches as empty branches.

 

Best,

Scuri

 

From: Benoit Germain [mailto:bnt.germain@gmail.com]
Sent: segunda-feira, 3 de fevereiro de 2014 12:03
To: IUP discussion list
Subject: [Iup-users] [IUP 3.10.1, Windows 7 64 bits] Problem selecting a branch in IupTree

 

Hello,

I have an application where I populate dynamically a tree with branches and leaves based on the exploration of external resources, that worked fine with IUP 3.8 (as far as I can remember). I populate a branch with its children when said branch is selected ans has no child, in selected_cb(). But with 3.10.1, I can no longer select a branch when it is the sole element in the tree, thus preventing me from doing anything useful in that case (change the getResources() function at the beginning of the script).


Even when I populate the tree with more than one branch, I can only select the second one before I can select the first. Setting tree.value = -1 doesn't change anything. Setting ADDEXPANDED to "NO" doesn't enable me to select the first branch either, and has the additional issue of preventing me from expanding the branches after having dynamically populated them.

How can I tell the tree I want to be able to select the first branch I added right from the start?

Regards,

 

--
Benoit.