hagens@CS.WISC.EDU (12/13/88)
I want to duplicate something that Xmh does:
create a Viewport widget, create a Box widget inside the Viewport, and
then create Command widgets inside the Box widget. When I run the sample
program below, I get a box with 3 buttons in it (if 3 is passed as an
argument). When I click on a button, my callback is invoked, but
I do not get a scroll bar formed by the viewport. If I manually
resize the whole thing, then I do get a scroll bar. However, if I then
add more buttons, the scroll bar does not change accordingly and I
can not access the new command buttons.
Any help would be appreciated. Please excuse the sloppyness of the example.
Environment: X11R2 on IBM PC/RT, AOS Release 2, AED, APC card
ps. my example is based upon xboxes.c in the examples directory
================ cut here to see sloppy example =============================
#ifndef lint
static char rcsid[] = "$Header: xboxes.c,v 1.12 88/02/14 15:08:38 rws Exp $";
#endif lint
#include <stdio.h>
#include <X11/Intrinsic.h>
#include <X11/Atoms.h>
#include <X11/Label.h>
#include <X11/Command.h>
#include <X11/Box.h>
#include <X11/Viewport.h>
#include <X11/Cardinals.h>
static Widget toplevel;
Widget viewp;
Widget viewp_inner;
void poof(widget,closure,callData)
Widget widget;
caddr_t closure;
caddr_t callData;
{
Widget w;
(void) fprintf(stderr,"poof callback\n");
w = XtCreateManagedWidget("NEW", commandWidgetClass, viewp_inner,
NULL, (Cardinal)0);
XtRealizeWidget(w);
}
void main(argc, argv)
unsigned int argc;
char **argv;
{
static Arg viewArgs[] = {
{XtNheight, 400},
{XtNwidth, 80},
{XtNallowVert, True},
};
static Arg boxArgs[] = {
{XtNheight, 400},
{XtNwidth, 80},
};
static XtCallbackRec callbacks[] = {
{poof, NULL},
{NULL, NULL},
};
static Arg butArgs[] = {
{XtNcallback, (XtArgVal)callbacks},
};
int i;
Widget xyzzy;
toplevel = XtInitialize( NULL, "Xb", NULL, 0,
&argc, argv);
viewp = XtCreateManagedWidget(NULL, viewportWidgetClass, toplevel,
viewArgs, XtNumber(viewArgs));
viewp_inner = XtCreateManagedWidget(NULL, boxWidgetClass, viewp,
NULL, (Cardinal)0);
for (i=0; i<atoi(argv[1]); i++) {
char buf[10];
sprintf(buf, "button %d", i);
xyzzy = XtCreateManagedWidget(buf, commandWidgetClass, viewp_inner,
butArgs, XtNumber(butArgs));
}
XtRealizeWidget(toplevel);
XtMainLoop();
}swick@ATHENA.MIT.EDU (Ralph R. Swick) (12/14/88)
Date: Mon, 12 Dec 88 16:12:27 -0600
From: hagens@cs.wisc.edu
... When I click on a button, my callback is invoked, but
I do not get a scroll bar formed by the viewport.
I cannot reproduce this under X11R3.
... if I then
add more buttons, the scroll bar does not change accordingly and I
can not access the new command buttons.
This bug still exists.