[comp.windows.x] Athena Form Widget Bug?

mcintyrd@cs.rpi.edu (David McIntyre) (04/25/89)

I have just tried Form Widgets, and I don't think they work.
Here is what I want to do:
	a) create a form widget.
	b) add 3 labels, positioned as I want.
	c) make the labels un-resizable.
	
Here is what happens:
	a) the labels get created.
	b) they are the wrong size (I ask for 25x30, the estimated
		actual size is 100x100)
	c) they resize when the window is resized.

Is this a bug?  You tell me, please.  I would love to know what
I am doing wrong.  

The sample code follows.

			Thanks,
			   Dave

--------------------------------------
#include <stdio.h>
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>

#include <X11/Shell.h>
#include <X11/Label.h>
#include <X11/Form.h>

void main(argc, argv)
int argc;
char **argv;
{
Arg arg[10];
XtAppContext ape;
Display *dpy;
Widget toplevel,form,label1,label2,label3;

    XtToolkitInitialize();
    ape = XtCreateApplicationContext();
    dpy = XtOpenDisplay(ape,NULL,argv[0],"Demos",NULL,0,&argc,argv);

    XtSetArg(arg[0],XtNwidth,(XtArgVal)300);
    XtSetArg(arg[1],XtNheight,(XtArgVal)200);
    toplevel = XtAppCreateShell(argv[0],"Demos",
                           applicationShellWidgetClass,dpy,arg,2);

    form = XtCreateManagedWidget("form",formWidgetClass,toplevel,NULL,0);

    XtSetArg(arg[0],XtNresizable,False);
    XtSetArg(arg[1],XtNheight,25);
    XtSetArg(arg[2],XtNwidth,30);
    XtSetArg(arg[3],XtNresize,False);
    label1 = XtCreateManagedWidget("label1",labelWidgetClass,form,arg,4);

    XtSetArg(arg[0],XtNfromHoriz,label1);
    XtSetArg(arg[1],XtNhorizDistance,2);
    XtSetArg(arg[2],XtNresizable,False);
    XtSetArg(arg[3],XtNresize,False);
    XtSetArg(arg[4],XtNheight,40);
    XtSetArg(arg[5],XtNwidth,50);
    label2 = XtCreateManagedWidget("label2",labelWidgetClass,form,arg,6);

    XtSetArg(arg[0],XtNfromVert,label2);
    XtSetArg(arg[1],XtNvertDistance,0);
    XtSetArg(arg[2],XtNresizable,False);
    XtSetArg(arg[3],XtNresize,False);
    XtSetArg(arg[4],XtNheight,40);
    XtSetArg(arg[5],XtNwidth,50);
    label2 = XtCreateManagedWidget("label2",labelWidgetClass,form,arg,6);

    XtRealizeWidget (toplevel);
    XtAppMainLoop(ape);
}


Dave "mr question" McIntyre     |      "....say you're thinking about a plate
mcintyre@turing.cs.rpi.edu      |       of shrimp.....and someone says to 
office : 518-276-8633		|	you `plate,' or `shrimp'......"
home   : 518-271-6664		|

converse@EXPO.LCS.MIT.EDU (Donna Converse) (04/28/89)

>Here is what I want to do:
>	a) create a form widget.
>	b) add 3 labels, positioned as I want.
>	c) make the labels un-resizable.
	
>Here is what happens:
>	a) the labels get created.
>	b) they are the wrong size (I ask for 25x30, the estimated
>		actual size is 100x100)
>	c) they resize when the window is resized.

Read the very recent posting of Chris Peterson,
Re: dialog, label, and transient shell widget problems
It contains a description of the form widget resources which 
will answer your questions.

Try 
XtSetArg(arg[n], XtNtop, XtChainTop); n++;
XtSetArg(arg[n], XtNleft, XtChainLeft); n++;
XtSetArg(arg[n], XtNbottom, XtChainTop); n++;
XtSetArg(arg[n], XtNright, XtChainLeft); n++;

The labels will have the originally requested
size, and will not resize, when this code is
added to your original example code.