[comp.windows.x] X11R4 Dialog Widget Question

tan@ektools.UUCP (Thomas A. Napoli) (02/28/90)

I am running X11R4 on a Sun 3/60, SunOS 4.0.3.  I am trying to upgrade
an application that uses the Athena widget set.  I can't seem to get a
Dialog widget that displays a default string value to work.  An X
protocol error occurs when I issue the following call:

       dialog = XtCreateManagedWidget ( "dialog", dialogWidgetClass,
			root_wid, dialogArgs, XtNumber (dialogArgs) );

This call (and the setup of dialogArgs) works when the "value" resource
is set to NULL, but not when I set the resource to allow user input.

The X Protocol message:

X Error of failed request:  BadWindow (invalid Window parameter)
  Major opcode of failed request:  38 (X_QueryPointer)
  Minor opcode of failed request:  0
  Resource id in failed request:  0x0
  Serial number of failed request:  205
  Current serial number in output stream:  205

Can someone tell me what has changed since R3 WRT the Dialog Widget?
The release notees say that no changes will be necessary for the Dialog
widget, but perhaps, it ain't necessarily so.

-------------------------------------------------------------------
	Tom Napoli			UUCP : ...!kodak!aviary!tan
					  or   tan@ssd.kodak.com
				    	Voice: (716) 253-7795

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

>       dialog = XtCreateManagedWidget ( "dialog", dialogWidgetClass,
>			root_wid, dialogArgs, XtNumber (dialogArgs) );

> This call (and the setup of dialogArgs) works when the "value" resource
> is set to NULL, but not when I set the resource to allow user input.

Does the example program `examples/Xaw/popup' work for you?  Does it work if
you set the value field (it currently is set to <empty+string>)?

In short I need some example code to track down your problem.

> The X Protocol message:

> X Error of failed request:  BadWindow (invalid Window parameter)
>   Major opcode of failed request:  38 (X_QueryPointer)
>   Minor opcode of failed request:  0
>   Resource id in failed request:  0x0
>   Serial number of failed request:  205
>   Current serial number in output stream:  205

Looks to me like someone is doing a query pointer on an unrealized widget.
The Dialog widget doesn't do any query pointer calls so I don't think it
is the Dialog's fault.

> Can someone tell me what has changed since R3 WRT the Dialog Widget?
> The release notees say that no changes will be necessary for the Dialog
> widget, but perhaps, it ain't necessarily so.

There is a difference between no external changes, and no internal changes.  I
did change some of the internal code of the Dialog, but have never seen the
problem that you are having.


						Chris D. Peterson     
						MIT X Consortium 

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

tan@ektools.UUCP (Thomas A. Napoli) (03/22/90)

---------------
I have had some problems posting to news recently, so this may be a
repeat.  If so, I apologize.
---------------
I am running X11R4 on a Sun 3/60, SunOS 4.0.3 and trying to upgrade
an application that uses the Athena widget set.  A Dialog widget that
displays a default string value works under R3 but not under R4.  An X
protocol error occurs using the following code.  The "root_wid" is of the
"formWidgetClass".

I would appreciate any insight into what I might be doing wrong.
The release notes indicate that changes are not necessary for the Dialog
widget, but then again ... 

static  Arg     dialogArgs [] = {       /* dialog widget set-up */
        { XtNhorizDistance,     (XtArgVal) 20 },  /* Form widget resource */
        { XtNvertDistance,      (XtArgVal) 60 },  /* Form widget resource */
        { XtNwidth,  (XtArgVal) 200 },
        { XtNheight,  (XtArgVal) 70 },
        { XtNlabel,  NULL },
        { XtNvalue,  NULL },
    };  /* dialogArgs */

char            *dest_folder;
char            *malloc ();
    dest_folder = malloc ( 100 );


/* subset of callback code follows */

char    *dialog_label = "Enter destination folder name:";

        if ( ! *dest_folder )
            strcpy ( dest_folder, "default_folder" );
	XawPanedSetRefigureMode ( pane, False );

        dialogArgs[2].value = (XtArgVal) 220;
        dialogArgs[4].value = (XtArgVal) dialog_label;
        dialogArgs[5].value = (XtArgVal) dest_folder;

        dialog = XtCreateManagedWidget ( "dialog", dialogWidgetClass,
			root_wid, dialogArgs, XtNumber (dialogArgs) );

        XawDialogAddButton ( dialog, "OK", Ok, client_data );
        XawDialogAddButton ( dialog, "CANCEL", Cancel, (caddr_t) NULL );

        XtRealizeWidget ( dialog );

This all works when the "XtNvalue" resource is set to NULL, but not
when an initial value is assigned (as above).

The X Protocol message:

X Error of failed request:  BadWindow (invalid Window parameter)
  Major opcode of failed request:  38 (X_QueryPointer)
  Minor opcode of failed request:  0
  Resource id in failed request:  0x0
  Serial number of failed request:  205
  Current serial number in output stream:  205

-------------------------------------------------------------------
	Tom Napoli			UUCP : ...!kodak!aviary!tan
					  or   tan@ssd.kodak.com
				    	Voice: (716) 253-7795

converse@EXPO.LCS.MIT.EDU (Donna Converse) (03/23/90)

> I am running X11R4 on a Sun 3/60, SunOS 4.0.3 and trying to upgrade
> an application that uses the Athena widget set.  A Dialog widget that
> displays a default string value works under R3 but not under R4.  An X
> protocol error occurs using the following code.  The "root_wid" is of the
> "formWidgetClass".

Your code fragments work here.  I don't know what the problem is.
Do you ever set the string variable dest_folder to contain the null string?

Using a debugger and running with the -synchronize flag, you should be
able to identify which libarary call results in the protocol error.


Donna Converse
converse@expo.lcs.mit.edu