Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!sun-barr!cs.utexas.edu!samsung!think.com!mintaka!bloom-beacon!eru!hagbard!sunic!mcsun!ukc!stl!siesoft!stuart From: stuart@siesoft.co.uk Newsgroups: comp.windows.x.motif Subject: Help wanted with focus policy. Summary: How do I stop editing a text widget? Keywords: Help, Focus Policy, Text widgets Message-ID: <1990Nov21.154611.25895@siesoft.co.uk> Date: 21 Nov 90 15:46:11 GMT Sender: usenet@siesoft.co.uk (NNTP Poster) Distribution: comp Organization: Siemens-Nixdorf Systems Development Group, UK Lines: 54 Environment: Siemens hardware (X20), Motif 1.0, X11r3 server. I have been following the focus policy discussions with interest, hoping that one of the articles would answer a problem that I have with text widgets. Apologies if my question has already been answered but I must have missed it if it has. In the simplest case, I have a window with a single text widget. I want to be able to do just two things: 1) start editing the text widget from my application, i.e. without the user having to click on the text widget. 2) stop editing the text widget, i.e. lose the focus, without the user having to click on another text widget (there isn't another one :-) Dan Heller suggested using XSetInputFocus (surprise, surprise :-) to solve a similar problem with two widgets. So I should be able to go: { XtAddCallback(window, XmNinputCallback, MouseClick, NULL); ... } void MouseClick(Widget w, char *dummy, XmAnyCallbackStruct *datap) { XSetInputFocus(XtDisplay(w), XtWindow(w), RevertToParent, CurrentTime); } and then the editing on the text widget will stop when the user clicks on the window's background. When I try this it either doesn't work or I lose the focus for good. Gabe Begeddov sugetested that one should use the undocumented _XmGrabTheFocus call to move the focus to a particular widget. The first time that this call is made to start editing the text widget it works. However, it never works when used in trying to move the focus to the window (to stop the editing) or on subsequent calls to restart the editing. He also mentions a XmProcessTraversal() service in Motif 1.1 as the being the correct way to do this. Is there a way round this problem with Motif 1.0? Will XmProcessTraversal() do what I want when I get Motif 1.1? All and any help is much appreciated, Stuart. - -- S I E M E N S Stuart Hood 65-73 Crockhamwell Road, Woodley, Berkshire, UK ------------- Phone: + 44-734-691994 Email: stuart@siesoft.co.uk N I X D O R F The trouble with everyone, is that they generalise too much