Home
Support

Knowledge Base

BSPs and drivers
Community resources
Product documentation
Questions?
Contact us

How can you get a callback for the scroll bar on a multitext widget?
 
________________________________________________________________________

Applicable Environment
________________________________________________________________________
  • Topic: callback for scroll bar on a multitext widget
  • SDP: 6.4.1
  • Target: Any supported target
________________________________________________________________________

Recommendation
________________________________________________________________________

With the Pt_Multitext widget you need to first find the Scroll Bar widget. This can be done using the PtWidgetFamily function on the multitext widget. Once you have identified the scroll bar you can then attach a callback to it to be alerted to when it is moved.

static int my_callback( PtWidget_t *widget, void *data, PtCallbackInfo_t *cbinfo )
{
PtScrollbarCallback_t *cbdata = (PtScrollbarCallback_t*) cbinfo->cbdata;

fprintf (stderr, "Current Scroll Position is %d\n", cbdata->position);

return (Pt_CONTINUE);
}

int find_scrollbar ( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
PtWidget_t *root;
PtWidget_t *current;

root = current = widget;

while (current = PtWidgetFamily (root, current))
if (PtWidgetIsClass (current, PtScrollbar))
PtAddCallback (current, Pt_CB_SCROLL_MOVE, my_callback, 0);

return( Pt_CONTINUE );
}

________________________________________________________________________
NOTE: This entry has been validated against the SDP version listed above. Use caution when considering this advice for any other SDP version. For supported releases, please reach out to QNX Technical Support if you have any questions/concerns.
________________________________________________________________________


Related Attachments
 None Found





Please contact us with your questions or concerns.