larry@hydro.saic.COM (Larry Clark) (04/17/91)
Can anyone out there tell me how I can set the input focus to a particular instance of a motif text widget? I would like to be able to send the user off to different text input fields depending on what he types into the current one. I have done just fine reading keystrokes in the current text widget but can't go to another one. Thanks for any help you can give. larry@hydro.saic.com Laurance Clark SAIC MS 2-7-1 1710 Goodridge Drive McLean, VA 22102 (703) 734-5907
converse@expo.lcs.mit.EDU (Donna Converse) (04/17/91)
> Can anyone out there tell me how I can set the input focus to > a particular instance of a motif text widget? See the Xt specification, section 7.3, "Focusing Events on a Child"
converse@expo.lcs.mit.EDU (Donna Converse) (04/17/91)
Can anyone out there tell me how I can set the input focus to a particular instance of a motif text widget? See the Xt specification, section 7.3, "Focusing Events on a Child" Optimally, yes; in practice the Xt routines don't work and further confuse things. There are various Xm routines (documented and undocumented) which work more reliably. In case anyone is confused, they work fine for the Athena widget set. Perhaps I should refrain from answering questions when Motif is used! :-)
nazgul@alphalpha.com (Kee Hinckley) (04/17/91)
In article <9104162100.AA00388@hydro.Saic.COM> larry@hydro.saic.COM (Larry Clark) writes: >Can anyone out there tell me how I can set the input focus to >a particular instance of a motif text widget? I would like to be Depends on what version of Motif you have. In 1.1 you should use XmProcessTraversal. In 1.0 there's an undocumented call you can use who's name I forget. I believe that the answer is in the Motif FAQ which is posted regularly to comp.windows.x.motif -- Alfalfa Software, Inc. | Poste: The EMail for Unix nazgul@alfalfa.com | Send Anything... Anywhere 617/646-7703 (voice/fax) | info@alfalfa.com I'm not sure which upsets me more: that people are so unwilling to accept responsibility for their own actions, or that they are so eager to regulate everyone else's.
nazgul@alphalpha.com (Kee Hinckley) (04/17/91)
In article <9104162304.AA07526@excess.lcs.mit.edu> converse@expo.lcs.mit.EDU (Donna Converse) writes: > >> Can anyone out there tell me how I can set the input focus to >> a particular instance of a motif text widget? > >See the Xt specification, section 7.3, "Focusing Events on a Child" Unfortunately that won't work. Motif has a complicated internal concept of Focus that it uses to implement keyboard traversal. If you use the Xt calls you'll bypass this mechanism and it won't realize what's happened. The situation will degrade from there on. -- Alfalfa Software, Inc. | Poste: The EMail for Unix nazgul@alfalfa.com | Send Anything... Anywhere 617/646-7703 (voice/fax) | info@alfalfa.com I'm not sure which upsets me more: that people are so unwilling to accept responsibility for their own actions, or that they are so eager to regulate everyone else's.
vania@osf.ORG (Vania Joloboff) (04/18/91)
> From: converse@expo.lcs.mit.edu (Donna Converse) > > > Can anyone out there tell me how I can set the input focus to > a particular instance of a motif text widget? > > See the Xt specification, section 7.3, "Focusing Events on a Child" > > Optimally, yes; in practice the Xt routines don't work and further confuse > things. There are various Xm routines (documented and undocumented) which > work more reliably. > > In case anyone is confused, they work fine for the Athena widget set. > Perhaps I should refrain from answering questions when Motif is used! :-) > Motif has a keyboard traversal model that allows to navigate between the various widgets from the keyboard, a la Windows. It is not appropriate to use the Xt functions to set the focus, because it by-passes the Xm function. On later keyboard actions Motif will have a wrong idea of the current state. The right function to use is XmProcessTraversal. To traverse to a widget : XmProcessTraversal(widget, XmTRAVERSE_CURRENT) Note that it only works if the specified widget is traversable. Otherwise it will set focus to the first traversable widget in the same tab group.
masa@hpsciz.sc.hp.com (Masayoshi Habu) (04/19/91)
In comp.windows.x, converse@expo.lcs.mit.EDU (Donna Converse) writes: > Can anyone out there tell me how I can set the input focus to > a particular instance of a motif text widget? See the Xt specification, section 7.3, "Focusing Events on a Child" Motif has its own knowledge on the keyboard focus. Thus moving focus with Xt functions are prohibited. If you have Motif 1.1 or later, you should have XmProcessTraversal() which lets you move the focus to your desired place. If you have Motif 1.0, this functions was an internal one, so *officially* you can't call it. Because Motif 1.1 is different from Motif 1.0, migrating to Motif 1.1 is recommended. The syntax and usage of XmProcessTraversal() [in Motif 1.1] is: #include <Xm/Xm.h> Boolean XmProcessTraversal(widget, direction) Widget widget; int direction; widget Specifies the widget ID of the widget whose hierarchy is to be traversed direction Specifies the direction of traversal If you give XmTRAVERSE_CURRENT to direction and your target widget to widget parameter, the focus goes to your target. Other direction includes: XmTRAVERSE_DOWN, XmTRAVERSE_HOME, XmTRAVERSE_LEFT, XmTRAVERSE_NEXT, XmTRAVERSE_NEXT_TAB_GROUPm XmTRAVERSE_PREV, XmTRAVERSE_PREV_TAB_GROUP, XmTRAVERSE_RIGHT, and XmTRAVERSE_UP. Masa Habu