[comp.windows.x] Scrolling a Viewport Widget through Software

pusateri@lear.cs.duke.edu (Thomas J. Pusateri) (07/28/89)

     Has anyone figured out how to scroll an athena viewport widget
from within your program?  I have a list widget that is fairly long
inside a viewport and would like to be able to type a key and have
the list widget scroll down automatically to the place in the sorted
list starting with that letter typed.

     I thought I might be able to use XtScrollbarSetThumb but I don't
know the widget ID of the actual scrollbar in the viewport.

Thanks for any help

Tom Pusateri
National Biomedical Simulation Resource
Duke University Medical Center

pusateri@nbsr.mc.duke.edu

vojta@skippy.berkeley.edu (Paul Vojta) (08/01/89)

In article <15135@duke.cs.duke.edu> pusateri@lear.cs.duke.edu (Thomas J. Pusateri) writes:
>
>     Has anyone figured out how to scroll an athena viewport widget
>from within your program?  I have a list widget that is fairly long
>inside a viewport and would like to be able to type a key and have
>the list widget scroll down automatically to the place in the sorted
>list starting with that letter typed.
>
>     I thought I might be able to use XtScrollbarSetThumb but I don't
>know the widget ID of the actual scrollbar in the viewport.
>
>Thanks for any help
>
>Tom Pusateri
>National Biomedical Simulation Resource
>Duke University Medical Center
>
>pusateri@nbsr.mc.duke.edu

How about the following:
	1.  Use XtGetValues to get XtNwidth and XtNheight for the viewport
	    widget and XtNx and XtNy for the child widget (remembering that
	    then (-x,-y) will be the upper left viewable pixel);
	2.  Use XtNameToWidget(vport_widget, "horizontal") and
	    XtNameToWidget(vport_widget, "vertical") to get the widgets
	    for the horizontal and vertical scrollbars;
	3.  Use XtCallCallbacks(x_bar, XtNscrollProc, x) and
	    XtCallCallbacks(y_bar, XtNscrollProc, y) to set the scrollbars
	    in the desired positions.

I understand that step 2 above is not currently officially blessed, but that
there was some discussion previously about putting the names "vertical"
and "horizontal" in the documentation to make it legit.

Hope this helps.

--Paul Vojta, vojta@math.berkeley.edu