[comp.windows.x] Why don't my widgets work as expected?

wolf@cbnewsh.ATT.COM (thomas.wolf) (08/08/89)

In a recent posting I mentioned a problem I seem to be having with
keyboard translations when exeuting Doug Young's simple "one-line
edit-field" example program.  For some reason, some of the letters I
typed weren't displayed in the text-field (when I pressed the letter 'b',
for instance, it caused the field-widget's caret to backspace.)  In addition,
I would get a warning message from the toolkit telling me that previous
translation manager actions were overridden - when the widget was realized
for the first time.

Some folks suggested that I look at the order in which Young's example did
the translation manager overrides.  I went one step further:  I took out all
translation manager calls....but to no avail.

I figured, hey, maybe its the 386's implementation of the HP widget set that
is to blame, but found that to be unlikely as I just had the same problem
with an OpenLook program:

main(argc, argv)
	int argc;
	char **argv;
	{
	Widget toplevel, fieldwidget;

	toplevel = OlInitialize("top", "Top", NULL, 0, &argc, argv);

	/* TextField widgets are basically one-line edit widgets */
	fieldwidget = XtCreateManagedWidget("afield", textFieldWidgetClass,
		toplevel, NULL, 0);

	/* No call-backs, no translation manager overrides, no nothing */
	XtRealize(toplevel);
	XtMainLoop();
	}


This program (if I transcribed it correctly :-) compiles fine.  During
execution, it also exhibits the symptoms described above.

I am doing something stupid, I'm certain, but beats me what it is.  Can
someone help?

Any info would be appreciated,

Tom

P.S.  I did get rid of my .Xdefaults file - so I didn't "accidentally"
override key bindings by setting resources there.

grunwald@guitar.cs.uiuc.edu (Dirk Grunwald) (08/09/89)

the symptioms you describe occur with a buggy version of the HP widgets;
this also happened with e.g., Xwebster on a Sun. I eventually fixed this in
our local environment by reinstalling the HP widgets using patches that I
got from I know not where. They should be on expo.lcs.mit.edu though.

Dirk Grunwald -- Univ. of Illinois 		  (grunwald@flute.cs.uiuc.edu)

garyo@prometheus.think.com (Gary Oberbrunner) (08/09/89)

> In a recent posting I mentioned a problem I seem to be having with
> keyboard translations when exeuting Doug Young's simple "one-line
> edit-field" example program.  For some reason, some of the letters I
> typed weren't displayed in the text-field (when I pressed the letter 'b',
> for instance, it caused the field-widget's caret to backspace.)  In addition,
> I would get a warning message from the toolkit telling me that previous
> translation manager actions were overridden - when the widget was realized
> for the first time.

This is caused by the presence of keysyms that don't exist on your system
in the default translations.  Replace the translations entirely.  Look in
the HP Widgets source and you'll see lots of funny keysyms, and sure enough
the letters they begin with are the letters that you can't type.

--
					As always,

					Gary O

-----------------------------------------------------------------------------
Remember,		      Truth is not beauty;	    Gary  Oberbrunner
Information is not knowledge; Beauty is not love;  {ames,harvard}!think!garyo
Knowledge is not wisdom;      Love is not music;	      garyo@think.com
Wisdom is not truth;	      Music is the best. - FZ	  (617) 876-1111 x265

wolf@cbnewsh.ATT.COM (thomas.wolf) (08/09/89)

I found the problem which caused the "strangeness" I described in a previous
article.  Turns out I used an old Makefile (which I thought did everything
correctly) that linked in an old version of the Xtoolkit library (and
perhaps the order in which I linked in the libraries mattered too.)

I would never have found the stupid problem if I hadn't tried out the program
on another machine.  There, I manually entered the compile/link
commands - and sure enough, the program worked.  I guess it take experience
to associate an apparent run-time problem with the compile/link cycle of
development :-)

Thanks to those who suggested solutions/causes of the problem.
Sorry to have bothered the net with this one,

Tom