Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!dali.cs.montana.edu!caen!sdd.hp.com!wuarchive!udel!haven.umd.edu!uflorida!mlb.semi.harris.com!sloth.mlb.semi.harris.com!pjp From: pjp@sloth.mlb.semi.harris.com (Pat J. Pinchera) Newsgroups: comp.windows.x.motif Subject: Re: auto-traverse of text widgets Summary: a solution to auto-traverse of text widgets Keywords: XmAddTabGroup, XtOverrideTranslations Message-ID: <1991May7.165837.7431@mlb.semi.harris.com> Date: 7 May 91 16:58:37 GMT References: <2801F4F9.5C0D@deneva.sdd.trw.com> Sender: news@mlb.semi.harris.com Distribution: usa Organization: Interface & Control Systems, Inc. Lines: 51 Nntp-Posting-Host: sloth.mlb.semi.harris.com In article <2801F4F9.5C0D@deneva.sdd.trw.com> rroux@rigel.sdd.trw.com () writes: > >I'm stumped. I have a bulletinboard widget that contains two single line >text widgets and a couple labels. I want to be able to press >in one of the text widgets and have the focus automatically shift to the >other text widget. > >I tried using XtSetKeyboardFocus with limited success. The focus _does_ >change, but the text cursor in the first widget keeps blinking. It seems >that there is confusion between the program and the window manager as to >which widget really has the focus. > >Is there a better/another way? By the way, I'm using Motif 1.0.3 and the >X11R3 libraries, but running X11R4. > I had to add the widget(s) to a tab group so that a regular would make the cursor move between the text fields. Then I had to make the look like a to Motif; this is done with XtOverrideTranslations. Here is a code excerpt: /* ** make the text widgets part of a 'Tab Group' so that user ** can tab between text fields. See PG9-3, PG1-6, PR1-163 ** PG = Motif Programmer's Guide, v1.0, ** PR = Motif Programmer's Reference, v1.0 */ XmAddTabGroup ( widget ); /* ** make , Down-Arrow act like a Tab; ** make Up-Arrow act like a Shift-Tab (back tab) */ XtOverrideTranslations(widget, XtParseTranslationTable ("Return:next-tab-group()\n\ Down:next-tab-group() \n\ Up:prev-tab-group()")); I had heard of these two functions, XmAddTabGroup & XtOverrideTranslations, but never thought of where/when they could be used, and if I did, I surely didn't know exactly how to code them, i.e. syntax and such. When I got these examples from someone on the net, it became obvious. Now I wonder how many other 'amazing' feats can be accomplished with Motif!!! -- --------------------------------------------------------------------- Patrick J. Pinchera | Interface & Control Systems, Inc. pjp@sloth.mlb.semi.harris.com | Melbourne, Florida, USA ---------------------------------------------------------------------