[comp.windows.x] Using a viewport/list widget set properly...

morreale@bierstadt.scd.ucar.edu (Peter Morreale) (11/21/90)

I have a problem with a list/viewport widget combination.

It seems that whenever I update the list widget's "list", the viewport
shrinks to the size of the list widget.  (as documented). 

My problem is that I *always* want the viewport widget to be a certain 
height.  

How do I accomplish this?  

Note that I am also unmanaging the list, updating the list, and then 
re-managing again so that the scrollbars on the viewport will get 
updated.

I probably need a different strategy for handling the viewport, but am
clueless as to what I need to do.

Thanks for any pointers,
-PWM


Here's the function which updates the list....



char	*p[101] = { NULL };

/* -------------------------------------------------------------------- */
ReadCurrentSubject()
{
	register FILE	*fp;
	register int	i;
	char		text[20];
	struct index	current_indx;
	Arg		arg[1];
	Dimension	height;

     	/* 
	 *  First free the space used by the last list
	 */

	for (i = 0; p[i]; ++i)
		free(p[i]);

	/*
	 * Open the current index file and start reading the 
	 * entries.
	 */

	fp = open_indxfl(current_subject, "rb");

	for (i = 0; i < numrec; ++i) {
	    fread(&current_indx, sizeof(struct index), 1, fp);
	    strcpy ((p[i] = (char *) malloc(LISTCHARS)), current_indx.list_str);
	}

	fclose(fp);

	p[i] = NULL;   /* last entry should always be null */

	/* 
	 *  Unmanage the List so that the scrollbars will get updated
	 *
	 *  Sumpthin's very wrong here, Try to force the height of
	 *  the viewport *after* we get outta this....
	 */

	XtUnmanageChild(List);
	XawListChange(List, p, numrec, 0, False);
	XtManageChild(List);


}	/* END READCURRENTSUBJECT */
--
------------------------------------------------------------------
Peter W. Morreale                  email:  morreale@ncar.ucar.edu
Nat'l Center for Atmos Research    voice:  (303) 497-1293
Scientific Computing Division