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 Centering the text in a PtList widget
Ref. No. QNX.000009902
Category(ies) Development
Issue Is it possible to center the text strings in a PtList widget?



Solution Yes, it is possible. See the Pt_ARG_LIST_COLUMN_ATTR resource, defined by the PtGenList widget.  You cannot set this value in PhAB so you must do it from code.  For example if you wanted to center everything in a single column list box when a button was clicked you would do the following:

int ListCenter( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
x09PtArg_t Arg;
  PtListColumnAttributes_t  ColumnAttr;

x09/* eliminate 'unreferenced' warnings */
x09widget = widget, apinfo = apinfo, cbinfo = cbinfo;
x09
x09ColumnAttr.flags = Pt_LIST_COLUMN_CENTER;
x09PtSetArg ( &Arg, Pt_ARG_LIST_COLUMN_ATTR,  &ColumnAttr, sizeof (ColumnAttr));
x09PtSetResources ( ABW_list, 1, &Arg);
x09return( Pt_CONTINUE );
}

Now if you wanted to add more columns then change the ColumnAttr variable to have the number of elements equal to the number of columns in your list and then setup the flag for each element.  You must also change the sizeof (ColumnAttr) to sizeof (ColumnAttr) / ColumnAttr[0].