Path: utzoo!censor!geac!jtsv16!uunet!mstan!s6!chuck From: chuck@Morgan.COM (Chuck Ocheret) Newsgroups: comp.windows.x Subject: Changing case in a Motif Text Widget? Message-ID: Date: 7 Nov 89 17:13:48 GMT Distribution: comp.windows.x Organization: Morgan Stanley & Co., Inc., NY NY Lines: 49 All I want to do is have a Text widget which inverts upper/lower case keystrokes. That is, when you type a lower case 'm', an upper case 'M' should appear in the widget and vice versa. Other keys should be unaffected. Section 10.5, "KeyCode-to-KeySym Conversions" of the X Intrinsics manual (X11, Release 3, Oct. 1988) specifies how to provide your own key translator with XtSetKeyTranslator(). After lifting code for the default key translator, the following translator was produced: void myTranslateKey(dpy, keycode, modifiers, modifiers_return, keysym_return) Display *dpy; KeyCode keycode; Modifiers modifiers; Modifiers *modifiers_return; KeySym *keysym_return; { KeySym ks; XtPerDisplay perDisplay; perDisplay = _XtGetPerDisplay(dpy); *modifiers_return = 0; if ((modifiers & StandardMask) == 0) ks =_XtKeyCodeToKeySym(dpy,perDisplay,keycode,0); else if ((modifiers & (ShiftMask | LockMask)) != 0) ks =_XtKeyCodeToKeySym(dpy,perDisplay,keycode,1); else ks = NoSymbol; if (ks >= XK_a && ks <= XK_z) ks = ks-0x20; else if (ks >= XK_A && ks <= XK_Z) ks = ks+0x20; *keysym_return = ks; } Dbx shows that this function does indeed get called and it does the translation. However, the Text widget still shows untranslated keystrokes. What am I doing wrong? Is there some other mechanism I should be using? Do I really have to provide a big table for the translation manager? -- +------------------+ Chuck Ocheret, Sr. Staff Engineer +------------------+ | chuck@morgan.com | Morgan Stanley & Co., Inc. | (212)703-4474 | | Duty now ... |19th Floor, 1251 Avenue of the Americas| for the future. | +------------------+ New York, N.Y. 10020 USA +------------------+