
Example 10-1. The scroll_cells.c program (continued)
x = (int)xv_get(horiz_scrollbar, SCROLLBAR_VIEW_START);
y = (int)xv_get(vert_scrollbar, SCROLLBAR_VIEW_START);
for (xrects->count--; xrects->count >= 0; xrects->count--) {
printf("top–left cell = %d, %d –– %d,%d %d,%d0, x+1, y+1,
xrects->rect_array[xrects->count].x,
xrects->rect_array[xrects->count].y,
xrects->rect_array[xrects->count].width,
xrects->rect_array[xrects->count].height);
XCopyPlane(dpy, cell_map, win, gc,
xrects->rect_array[xrects->count].x,
xrects->rect_array[xrects->count].y,
xrects->rect_array[xrects->count].width,
xrects->rect_array[xrects->count].height,
xrects->rect_array[xrects->count].x,
xrects->rect_array[xrects->count].y, 1L);
}
}
10.4 Managing Your Own Scrollbar
A scrollbar may have delayed binding—that is, it may be created without an owner and
attached to objects that were created separately.
In most cases, you would probably never need to create a scrollbar that was not part of a text
subwindow or a canvas. These two packages handle all of the dirty work involved in manag-
ing and maintaining the types of attributes mentioned above. If you are using the CANVAS or
TEXTSW packages, you do not need to worry about any of this. If you do try to create your
own scrollbars and have them manage your own windows, you will probably find that you
will have reinvented the wheel in the form of the
CANVAS package.
If you are going to attempt ...