QNX RTOS v4 Knowledge Base
QNX RTOS v4 Knowledge Base
Title |
PtTree item is not removed when all sub items are removed |
Ref. No. |
QNX.000009871 |
Category(ies) |
Development |
Issue |
We have a PtTree widget with three levels. The root is called the 'project'. From the project there are 'broads', and from the boards there are 'aquisition events'.
Questions are:
Why is it that when we remove all 'aquisition events' for a 'board', the 'board' item still shows the expansion box?
What do we have to do to make it go away when all the items are removed?
We have called PtTreeShow() function for the 'board' item after all 'aquisition events' were removed, but that didn't work. |
Solution |
The expansion box is still shown, because it is controlled by the Pt_TREE_ITEM_EXPANDABLE flag and not by the fact thet the item has children. The flag is set automatically when you add children, but the widget never clears it.
So, to make it go away, you have to clear the Pt_TREE_ITEM_EXPANDABLE flag manually. You need to damage the item after you do it:
/*--------------Sample Code---------------*/ x09void disable_expansion_box(PtWidget_t *tree, PtTreeItem_t *item){ x09x09PtGenListItem_t *gi = &item->gen.list; x09x09gi->flags &= ~Pt_TREE_ITEM_EXPANDABLE; x09x09PtGenLIstDamageItem(tree, gi); x09}
PtTreeShow() does nothing if the item is already in the visible range. |
|