dymm@b.cs.wvu.wvnet.edu (David Dymm) (12/02/88)
I have only just started learning X11 so this is probably a simple question.
Please bear with me if you have seen this before.
I am using X11, release 2 and am trying to program as much as possible
with the toolkit.
I seem to encounter a problem with (I think...) XtRealizeWidget.
In the code segment below, notice that the arguement structure for the
"composite" widget, "krg_lasertool_args", has x, y, and borderwidth set.
And when the program returns from the call to XtCreateManageWidget,
the "lasertool" structure has the correct parameters for x, y, and borderwidth
as set in the arguement structure.
However as soon as I call XtRealizeWidget for the top level widget,
the composite widget's values for x, y, and borderwidth get changed to 0.
WHY ????
I then tried to change them with XtSetValues after the call to
XtRealizeWidget, but that had no effect.
Any explanations??? Is this a "bug", or am I doing something wrong???
/* *********************** cut here ******************** */
int
Xargc;
char
**Xargv;
Display
*KRG_if_topdisplay;
Screen
*KRG_if_topscreen;
Widget
KRG_if_toplevel;
Window
KRG_if_topwindow;
/* *************** */
/* LOCAL VARIABLES */
/* *************** */
HIDDEN XrmOptionDescRec options[] = {
"-foreground", "*foreground", XrmoptionSepArg, (caddr_t) NULL
};
HIDDEN Widget
lasertool;
Arg
krg_lasertool_args[] = {
{ XtNwidth, 200},
{ XtNheight, 300},
{ XtNborderWidth, 20},
{ XtNx, 100},
{ XtNy, 100}
};
HIDDEN XWMHints
krg_wmhints;
HIDDEN XSizeHints
krg_sizehints;
main (argc, argv)
int argc;
char **argv;
{
int
width,
height;
if ((KRG_if_toplevel = XtInitialize
("lasertool", "LAsertool", options,
XtNumber (options), &argc, argv)) == NULL)
{
fprintf (stderr, "**** FAILURE TO INITIALIZE 'X' SERVER ****\n\n");
fprintf (stderr, "**** EXITING PROGRAM ****\n");
exit (1);
}
if ((lasertool = XtCreateManagedWidget
("lasertool", compositeWidgetClass, KRG_if_toplevel,
krg_lasertool_args, XtNumber (krg_lasertool_args))) ==
NULL)
{
fprintf (stderr, "*** LASERTOOL CREATION FAILED ****\n");
exit (1);
}
XtRealizeWidget (KRG_if_toplevel);
/* THE PARAMETERS FOR "LAESRTOOL" GET CORRUPTED HERE!!!! */
XtMainLoop ();
}
David Dymm Software Engineer
USMAIL: Bell Atlantic Knowledge Systems,
145 Fayette Street, Morgantown, WV 26505
PHONE: 304 291-9898 (8:30-4:30 EST)
USENET: {allegra,bellcore, cadre,idis,psuvax1}!pitt!wvucsb!dymm
INTERNET: dymm@b.cs.wvu.wvnet.eduswick@athena.mit.EDU (Ralph R. Swick) (12/02/88)
> However as soon as I call XtRealizeWidget for the top level widget, > the composite widget's values for x, y, and borderwidth get changed to 0. Your example works just fine for me (under R3) - after adding the necessary #includes and #defining HIDDEN.