Home
Developer Resources
QNX RTOS v4
QNX RTOS v4 Knowledge Base

QNX RTOS v4 Knowledge Base

Foundry27
Foundry27
QNX RTOS v4 project
Resources

QNX RTOS v4 Knowledge Base

Title Images used in a PtTree widget behaviour
Ref. No. QNX.000009888
Category(ies) Development
Issue When clicking on an item in the PtTree widget, the image always changes to the off image.
Why?


Solution For each tree item, you have to provide two images: one image which will be displayed when the tree item is not selected(unsel_index) and one image which will be displayed when the item is selected(sel_index)- usually, the sel_index image will be the same as unsel_index image, but will be filled with the color of Pt_ARG_SELECTION_FILL_COLOR). You might need 4 images:
x09- sel_index_on
x09- unsel_index_on
x09- sel_index_off
x09- unsel_index_off.
When you call PtTreeItemAlloc use:
x09item_on = PtTreeItemAlloc(ABW_tree, string_on, sel_index_on, unsel_index_on);
x09item_off = PtTreeItemAlloc(ABW_tree, string_off, sel_index_off, unsel_index_off);
When you call PtTreeModifyItem use:
x09item_on = PtTreeItemAlloc(ABW_tree,tree_item, NULL, sel_index_on, unsel_index_on);
x09item_off = PtTreeItemAlloc(ABW_tree,tree_item, NULL, sel_index_off, unsel_index_off);

Do not mix index_on and index_off in the same call to PrTreeAllocation.
Pf course you might choose to have only two images: index_on and index_off and use:
x09item_on = PtTreeItemAlloc(ABW_tree, string_on, index_on, unsel_index_on);
x09item_off = PtTreeItemAlloc(ABW_tree, string_off, index_off, unsel_index_off);
In this case the image will not change at all when you select an item.