PtComboBox list scrollbar width also settable.

In a recent posting:

http://www.openqnx.com/index.php?name=PNphpBB2&file=viewtopic&t=5865&start=0&postdays=0&postorder=asc&highlight=

Misha Neferov provided a work-around so that the scrollbar width in a
PtList widget can be set differently from default value. (“Fix
coming in future release.”) The post-realization code worked!
Thanks Misha.

I was interested in using a PtComboBox as an alternative presentation
form. As you might guess, the scrollbar in the drop-down list is
based on the same foundation and has only a default width. I browsed
the include files in /usr/include/photon and came up with this
variation on Misha’s code:

int
set_cbox_scrollbar_width( PtWidget_t *widget, ApInfo_t *apinfo,
PtCallbackInfo_t *cbinfo ){
PtComboBoxWidget_t *list;
PtGenListWidget_t *glist;
unsigned short *width;

/* eliminate ‘unreferenced’ warnings */
widget = widget, apinfo = apinfo, cbinfo = cbinfo;

/* Use button width set by user in PhAB */
PtGetResource(widget, Pt_ARG_CBOX_BUTTON_WIDTH, &width,
0);

/* Crawl into structures to find scrollbar width of drop-down list
*/
list = (PtComboBoxWidget_t *) widget;
glist = (PtGenListWidget_t *) list->list_wgt;

/* Set actual scrollbar width */
if (glist->scrollbar)
PtSetResource(glist->scrollbar, Pt_ARG_WIDTH, *width,
0);

/* Apply voodoo to make “anchorage” work */
PtSetResource(widget, Pt_ARG_SCROLLBAR_WIDTH, *width-1, 0);
PtSetResource(widget, Pt_ARG_SCROLLBAR_WIDTH, *width, 0);

return( Pt_CONTINUE );
}

That’s Misha Nefedov – with a ‘d’ – sorry.

Bob