XmScrolledWindow

This forum is read only. No new submissions are accepted.

Questions about motif? Contact us

2 posts / 0 new
Last post
XmScrolledWindow

Submitted by Anonymous on Tue, 09/26/2000 - 22:04. Developers
I am facing a problem with XmScrolledWindow. My program has scrolled window widget and a button. I am using RowColumn widget as work window. XmScrolledWindow displays part of the row column widget. I want to move rowcolumn widget(Scrolled window`s work window) when I click on the button. I was trying to use XmScrollVisible. No use. I am attaching program with this. Any pointer or help.

#include
#include
#include
#include
Widget toplevel, row, sw, rc, but;
void my_button(Widget, XtPointer, XtPointer);

main(argc, argv)
int argc;
char *argv[];
{
XtAppContext app;
void traverse();
int i;
char name[10];

XtSetLanguageProc (NULL, NULL, NULL);

toplevel = XtVaAppInitialize (&app, "Demos", NULL, 0,
&argc, argv, NULL, NULL);

row = XtVaCreateManagedWidget("rowc", xmRowColumnWidgetClass, toplevel, NULL);

sw = XtVaCreateManagedWidget ("scrolled_w",
xmScrolledWindowWidgetClass, row,
XmNscrollingPolicy, XmAUTOMATIC,
NULL);

/* RowColumn is the work window for the widget */
rc = XtVaCreateWidget ("rc",
xmRowColumnWidgetClass, sw,
XmNorientation, XmHORIZONTAL,
XmNpacking, XmPACK_COLUMN,
XmNnumColumns, 10,
NULL);

for ( i = 0; i < 10; i++ ) {
sprintf (name, "Toggle %d", i);
XtVaCreateManagedWidget (name, xmToggleButtonWidgetClass, rc, NULL);
sprintf (name, "Button %d", i);
XtVaCreateManagedWidget (name, xmPushButtonWidgetClass, rc, NULL);
}
XtManageChild (rc);

but = XtVaCreateManagedWidget("button", xmPushButtonWidgetClass, row, NULL);

XtAddCallback(but, XmNactivateCallback, my_button, sw);

XtRealizeWidget (toplevel);
XtAppMainLoop (app);
}

void my_button(Widget widget, XtPointer client, XtPointer call)
{
Widget sw1 = (Widget) client;
Widget mywidget;
XtVaGetValues(sw1, XmNworkWindow, &mywidget, NULL);
XmScrollVisible (sw1, mywidget, 100, 100);

}

Anonymous

Hi!

Try this as callback-function

void my_button(Widget widget, XtPointer client, XtPointer call)
{
Widget sw1 = (Widget) client;
Widget widget_to_get_visible;

widget_to_get_visible = XtNameToWidget(rc, "Button 4");

XmScrollVisible (sw1, widget_to_get_visible, 0, 0);

}