[comp.windows.x] Athena Form Widget weirdness

mks@cs.brown.edu (Mark Stern) (02/24/90)

(I'm not sure if this is the correct newsgroup, but here goes...)

I'm experimenting with the Athena Form widget, and notice that
XawDoFormLayout doesn't seem to behave as expected. Suppose
I have a callback that relocates a button (just for kicks):

void RandomCallBack()
{
   Arg arg[1];

   XtSetArg(arg[0],XtNvertDistance,40);
   XtSetValues(button, arg, 1);         /* button is a global command Widget */

   XawFormDoLayout(form, TRUE);	        /* form is the parent of button */
}

Nothing happens. The button doesn't move to the correct place. I look
at the code for the Form widget, and decide to reach into the internals
and set a flag (I know, a big no-no):

set_form_layout_flag (w)
   Widget w;
{
   register FormWidget fw = (FormWidget) w;

   fw->form.needs_relayout = TRUE; /* forcibly set to TRUE */
}

If I call this routine before XawDoFormLayout, everything is peachy-keen.

Well, am I doing something wrong on the programmatic interface level?
I've checked O'Reilly Vol 5, the Athena docs, and even tried calling
XawFormDoLayout(w,FALSE) to supposedly increment an internal counter,
but the Form code doesn't seem to pay attention to it, either.
 
-- Mark 

------------------------------------------------------------------------------
             |      mks@cs.brown.edu       Box 1910, Dept. of Computer Science
 Mark Stern  |      mks@browncs.bitnet     Brown University
             |      uunet!brunix!mks       Providence, RI 02912

kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) (03/02/90)

> (I'm not sure if this is the correct newsgroup, but here goes...)

You're in the right place.

> I'm experimenting with the Athena Form widget, and notice that
> XawDoFormLayout doesn't seem to behave as expected. Suppose
> I have a callback that relocates a button (just for kicks):

> void RandomCallBack()
> {
>   Arg arg[1];

>   XtSetArg(arg[0],XtNvertDistance,40);
>   XtSetValues(button, arg, 1);         /* button is a global command Widget */

>    XawFormDoLayout(form, TRUE);        /* form is the parent of button */
> }

> Nothing happens. 

There are two problems here, one conceptual, and one genuine bug.

First the bug:

    When you perform an  XtSetValues() on the XtNvertDistance Resource it should 
automagically update the Form widget.  It doesn't do this.  This is a bug.

Now the conceptual problem:

    XawFormDoLayout() is meant to be used to stop layout processing for a while.
This functionality can be used to make processing a large number of requests
much faster.  XawFormDoLayout() will not force the Form widget to completely
relayout its children.

How do you work around this problem?  Short of fixing the code, you can't.
You will just have to live with it until the next release.

						Chris D. Peterson     
						MIT X Consortium 

Net:	 kit@expo.lcs.mit.edu
Phone:   (617) 253 - 9608	
Address: MIT - Room NE43-213