Path: utzoo!news-server.csri.toronto.edu!rutgers!bellcore!snoopy!ik From: ik@snoopy.bellcore.com (Ik Su Yoo) Newsgroups: comp.windows.x.motif Subject: Re: Setting keyboard focus Message-ID: <1991Mar11.213058.5300@bellcore.bellcore.com> Date: 11 Mar 91 21:30:58 GMT References: <1991Mar7.124545@MAX7.llnl.gov> <39956@cup.portal.com> <1991Mar11.132140.18706@bellcore.bellcore.com> <49493@seismo.CSS.GOV> Sender: usenet@bellcore.bellcore.com (Poster of News) Reply-To: ik@ctt.bellcore.com (Ik Su Yoo) Distribution: usa Organization: Bell Communications Research Lines: 44 In article <49493@seismo.CSS.GOV>, bonnett@seismo.CSS.GOV (H. David Bonnett) writes: > > Ik Su Yoo writes: > |> You may already know this but here is a quote from FAQ: > |> > |> Subject: 21) How can I direct the keyboard input to a particular widget? > |> > |> Answer: In Motif 1.1 call XmProcessTraversal(target, XmTRAVERSE_CURRENT). > |> In Motif 1.0 call the undocumented _XmGrabTheFocus(target). Do not use the > |> X or Xt calls such as XtSetKeyboardFocus since this bypasses the Motif > |> traversal layer and can cause it to get confused. This can lead to > |> odd keyboard behaviour elsewhere in your application. > > I have found that this does not work for me in the following case: > I have a rather complex widget hierarchy; but not extremely so, > I use a mainWindow that contains a Form passed as the work area of > the main_window. Then I have a ScrolledWindow child that contains a > another Form which is scrolled. It contains a group of RowColumns > each of which contain either labels or Text widgets. > > I want to set the keyboard focus to the first text widget created, > so when use the XmProcessTraversal call exactly as specified in > the FAQ and I get: > No focus on any of my widgets. The focus did work correctly w/o > this call before I added the layers of the scrolled window and 2nd > form. The resultant problem is that I grab the input on losingFocus > and if the widget never gets the focus well then it can't lose it.... > Any solution would be appreciated greatly. > Sorry, I, too, have used the above "feature" with only limited success. I was merely trying to point out the danger of using XtSetKeyboardFocus as mentioned in the FAQ listing. Any Motif expert out there want to enlighten us of making XmProcessTraversal work as expected? I already did RTFM and RTF-FAQ. Thanks. Ik Su Yoo RRC 1H-229, (908) 699-5764 ik@ctt.bellcore.com