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: Using the return key for traversal? Summary: a solution Keywords: Help, Traversal Message-ID: <1991May7.171327.7656@mlb.semi.harris.com> Date: 7 May 91 17:13:27 GMT References: <1991Feb12.113638.5936@siesoft.co.uk> Sender: news@mlb.semi.harris.com Distribution: comp Organization: Interface & Control Systems, Inc. Lines: 57 Nntp-Posting-Host: sloth.mlb.semi.harris.com In article <1991Feb12.113638.5936@siesoft.co.uk> stuart@siesoft.co.uk (Stuart Hood) writes: >Hardware: Siemens WX200. >Software: SCO Development Kit (Motif 1.0, X11 release 3). > >I have a main window with two child, text widgets. The main window >is a tab group so that the user may use the cursor up and down keys >to navigate between the two text objects. > >I would like somehow to have the return key behave like the cursor >down key, i.e. if the user hits return then it navigates to the >next text object as if they had pressed the cursor down key. > >I could add an activate callback to each widget and then navigate >to the desired widget using _XmGrabTheFocus() but this seems a >little messy. I would be happier using XmProcessTraversal but >I do not have Motif 1.1. > >I would be grateful to anyone who can come up with a cleaner method >of doing this. > >Stuart. I just posted an answer to another person asking a similar question. At the risk of wasting a little bandwidth, here's the solution I implemented with 1.0 (credit goes to some kind soul on the net who responded to my request several months ago). I had to add the widget(s) to a tab group so that a regular would make the cursor move between the text fields. Than had to make the , and 'down-arrow' 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()")); -- --------------------------------------------------------------------- Patrick J. Pinchera | Interface & Control Systems, Inc. pjp@sloth.mlb.semi.harris.com | Melbourne, Florida, USA ---------------------------------------------------------------------