Back Up Next

Scrolling

This is actually very simple. You just take the widget in which you want to be able to scroll, and instead of linking it to the form, you create a Viewport widget which you link to the form, and then you link your widget to the viewport.

Basically, instead of:

  form = XtVaCreateManagedWidget ("form", formWidgetClass, toplevel, NULL);
  blaat = XtVaCreateManagedWidget ("blaat", blaatWidgetClass, form, NULL);

you write:

  form = XtVaCreateManagedWidget ("form", formWidgetClass, toplevel, NULL);
  vp = XtVaCreateManagedWidget ("vp", viewportWidgetClass, form, NULL);
  blaat = XtVaCreateManagedWidget ("blaat", blaatWidgetClass, vp, NULL);

The Viewport widget has a few interesting resources that you can use for scrolling. Here are a few of them:


Back Up Next

Last updated: January 31, 2003 by Jaap Boender