Listbrowser lists

3 posts / 0 new
Last post
Antikken
Antikken's picture
Offline
Last seen: 12 years 5 months ago
Joined: 2011-05-19 22:37
Listbrowser lists

I have a small problem(hopefully).
I've got a list in my listbrowser which the user can dele 1 entry from. But at that same time, i have another struct list which only holds filenames. That i want to delete the same entry from. This means that when the node has been deleted from the listbrowser list i need to get the node from the other struct list and use that to delete a local file and then just remove that line from the list.

Finding and removing the node from the listbrowser list is easy, the problem is the other list.

Also i'm scratching my head over another small thing.

When i remove an entry from the listbrowser list, i have numbers on the left column. Which shows how many entries the user have. When i remove one entry, there will be one number missing. Not sure how to change the numbers in the struct list so they are right again.

thanks...

thomas
thomas's picture
Offline
Last seen: 3 months 1 week ago
Joined: 2011-05-16 14:23
When allocating the

When allocating the listbrowser node, use the LBNA_NodeSize to reserve some space behind the node and put a pointer to the other list's node there.

  1. struct mylbnode {
  2. struct Node node;
  3. struct Node *othernode;
  4. };
  5.  
  6. struct mylbnode *lbnode;
  7. struct Node *other_node;
  8.  
  9. lbode = (struct mylbnode *) AllocListBrowserNode (columns,LBNA_NodeSize,sizeof(struct mylbnode),TAG_END);
  10. other_node = alloc_other_node();
  11. lbnode->othernode = other_node;

When you remove the nodes you can do it like this:

  1. other_node = lbnode->othernode;
  2. Remove (&lbnode->node);
  3. FreeListBrowserNode (&lbnode->node);
  4. Remove (other_node);
  5. free_other_node (other_node);
salass00
salass00's picture
Offline
Last seen: 6 months 1 week ago
Joined: 2011-02-03 11:27
When allocating the


When allocating the listbrowser node, use the LBNA_NodeSize to reserve some space behind the node and put a pointer to the other list's node there.

LBNA_UserData could be used for this purpose as well.

Log in or register to post comments