ronnie@sos.com (Ron Schnell) (03/07/91)
I've narrowed down the problems I've been having with the Athena widgets. Could someone please tell me if this is a known bug? I have a list under a viewport under a box. The viewport has fixed values for both width and height. Let's say for example that the height of the list is smaller than the height of the viewport. When I first manage the list, it comes up fine, with the list displayed and blank space in the viewport below it. However, if I change the list with XtListChange, and the list height is still smaller, the viewport will suddenly SHRINK DOWN...so much that it even cuts off the bottom element of the list. I don't think that the viewport should shrink at all. The only way I can get around the problem is to manually unmanage the viewport from the box after changing the list, and set the width and height to the same fixed values again! #Ron (ronnie@sos.com)
morreale@bierstadt.scd.ucar.edu (Peter Morreale) (03/09/91)
In article <169@sos.com>, ronnie@sos.com (Ron Schnell) writes: > > .... Could someone please tell me if this is a known bug? Don't know that I'd call it a bug, rather a "feature" ;-) > I have a list under a viewport under a box. The viewport has fixed > values for both width and height. If the viewport will always have a fixed width and height, *and* it sits in a form widget, I suspect you could constrain the viewport to not resize by setting the following constraint resources, here's an example: XtSetArg(arg[n], XtNleft, XtChainLeft); ++n; XtSetArg(arg[n], XtNright, XtChainLeft); ++n; XtSetArg(arg[n], XtNtop, XtChainTop); ++n; XtSetArg(arg[n], XtNbottom, XtChainTop); ++n; Refer to pages: 105-106 of the MIT document "Athena Widget Set - C Language Interface" for details. I suspect this will work, though I haven't tried it personally. > > > However, if I change the list with XtListChange, and the list height > is still smaller, the viewport will suddenly SHRINK DOWN...so much > that it even cuts off the bottom element of the list. I don't > think that the viewport should shrink at all. More than likely, you have the last argument to XawListChange set to "True". This causes the list to tell the viewport that it is ok to resize itself to the actual size of the list. Just setting that argument to "False" doesn't work either as the scrollbar in the viewport will not reset itself to accomodate the new list items. In my case, I wanted to allow the user the ability to resize the app and have my viewport resize accordingly. What I did was to grab the width of the viewport, reset the list items (with the last arg set to "False") , then reset the width of the viewport to itself. I suspect what is was needed is to send an expose event (??) to the viewport to get it to reset the scrollbar. This is certainly kludgy, but it works nicely and there isn't the offensive visual that mapping and unmapping causes. Here is my code: /* Update the list and reset the scrollbar thumb */ XtSetArg(arg[0], XtNwidth, &width); XtGetValues(Entries, arg, 1); XtSetArg(arg[0], XtNwidth, width); XawListChange(List, p, cnt, -1 , False); XtSetValues(Entries, arg, 1); What is the "correct" method? -PWM ------------------------------------------------------------------ Peter W. Morreale email: morreale@ncar.ucar.edu Nat'l Center for Atmos Research voice: (303) 497-1293 Scientific Computing Division Consulting Office ------------------------------------------------------------------