Caution: This version of this document is no longer maintained. For the latest documentation, see


Allocate a new item


PtTreeItem_t *PtTreeAllocItem( 
                  PtWidget_t const *tree, 
                  const char *string,
                  short set_img,
                  short unset_img );


This function allocates a new item. The item's string is copied from string.

The set_img argument is the index of the image to be displayed when the item is set, and unset_img is the image to be displayed when it isn't set. An item is considered set if its flags masked with the Pt_ARG_TREE_IMGMASK resource of the widget give a nonzero value.

The image must be already present in the widget: if you specify an index that's larger than the current image count, it's changed to -1. A value of -1 means “no image.”

Note: Use PtTreeAddFirst() and PtTreeAddAfter() to add the new item to a tree structure.


See Allocating items and building a tree in the description of PtTree.



Interrupt handler No
Signal handler No
Thread No

See also:

PtTree, PtTreeAddAfter(), PtTreeAddFirst(), PtTreeAddImages(), PtTreeFreeAllItems(), PtTreeFreeItems(), PtTreeItem_t, PtTreeModifyItem(), PtTreeModifyItemString()