Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!uunet!bellcore!snoopy!ik From: ik@snoopy.Berkeley.EDU (Ik Su Yoo) Newsgroups: comp.windows.x.motif Subject: Re: Setting keyboard focus Message-ID: <1991Mar11.132140.18706@bellcore.bellcore.com> Date: 11 Mar 91 13:21:40 GMT References: <1991Mar7.124545@MAX7.llnl.gov> <39956@cup.portal.com> Sender: usenet@bellcore.bellcore.com (Poster of News) Reply-To: ik@ctt.bellcore.com (Ik Su Yoo) Organization: Bell Communications Research Lines: 45 In article <39956@cup.portal.com>, Link_-_APO@cup.portal.com writes: > >Here's the poop - > > >I've got a few XmText widgets sitting in an XmForm. My basic goal > >is to re-write the tab grouping mechanism so that I can do my > >own validation before moving onto another XmText widget. (i.e. when > >I press Tab, I want to check the contents of the XmText, if it's > >ok then I'll move on; otherwise I stay where I am and do some sort > >of error handling). > > >Currently, I'm using XtSetKeyboardFocus(), but I wind up with TWO text fields > >with cursors. I guess one of my problems is that I can't force one > >of the widgets to "give up" input focus. > > >Any hints out there? Thanks much! > >rich mayfield > > Hi Rich, > > You didn't say what your arguments were to XtSetKeyboardFocus(). > Try using something like: > XtSetKeyboardFocus( root_widget, text_widget ) ; > or > XtSetKeyboardFocus( form_widget, text_widget ) ; > > Good Luck! > ---------------------------------------------------------------- > > Sandy Johan link_apo@cup.portal.com(Sandy) > sun!portal!cup.protal.com!link_apo 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. Ik Su Yoo RRC 1H-229, (908) 699-5764 ik@ctt.bellcore.com