QNX RTOS v4 Knowledge Base
QNX RTOS v4 Knowledge Base
Title |
Adding scrollbars to a wide PtList box |
Ref. No. |
QNX.000009933 |
Category(ies) |
Development |
Issue |
Is there an easy way to scroll through the text in a PtList box that has alot of text in it?
|
Solution |
Add a horizontal scrollbar, and in its callback, set the Pt_ARG_LIST_COLUMN_POS resource to move the list items horizontally. Here is sample code:
x09int scrolled(PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo){ x09x09PtScrollbarCallback_t const *scb = cbinfo->cbdata; x09x09PtListColumn_t column; x09x09PtArg_t arg; x09x09column.from = MY_MARGIN - scb->position; x09x09column.to = column.from + COLUMN_WIDTH; x09x09PtSetArg(&arg, Pt_ARG_LIST_COLUMN_POS, &column, 1); x09x09PtSetResources(ABW_list, 1, &arg); x09x09return Pt_CONTINUE; x09}
One more thing is figuring out the max value for the scrollbar -- unless the set of list items is fixed, PgExtentText will have to be done to find the widest item. |
|