Submitted by Anonymous (not verified) on Fri, 06/15/2012 - 12:07
Hi all,
Can someone tell me if calling XmProcessTraversal on a widget will trigger an event with the FocusChangeMask?
I want to programmatically set focus on a widget, let the OS generate the necessary event, catch it and react accordingly in an another piece of code.
Basically, I would like the same piece of code for handling both mouse click in my widget and programmatically setting focus on it.
The following piece of code adds the necessary mask and I do receive the lose and gain focus on my drawing area if the user clicks in it with the mouse (thus setting focus to it).
XtAddEventHandler(wDrawingArea,
FocusChangeMask,
False, (XtEventHandler) EventHandler,
NULL);
However, calling
XmProcessTraversal(wDrawingArea, XmTRAVERSE_CURRENT)
on the same widget will not generate the event that should be caught by my EventHandler function.
Kenton Lee`s page does mention problem with the XmProcessTraversal function but I could use more info on this.
Tx in advance.
‹ How to create your own motif-resources (not the predefined.) return to the code from where a message screen was called. ›
Mon, 10/27/2003 - 21:19#1
XmProcessTraversal and Events.
Focus is funny in X. Only the top-level window has focus; events are forwarded within the Motif application as necessary.
One alternative approach for you is to use widget-based messaging. Elsewhere on this site, there`s an article with the "Router" widget which does exactly that; one part of your code gets a callback when an event of interest happens. You trigger off of this rather than the low-level FocusChange.