resend key event in Linux

Andreas Micheler Andreas.Micheler at Student.Uni-Augsburg.de
Thu May 3 11:17:55 PDT 2007


Milan Babuskov wrote:
> Vadim Zeitlin wrote:
>> AM> > Andreas Micheler wrote:
>> AM> >> I'd like to use the wx event system rather than SendMessage,
>> AM> >> but it doesn't seem to work.
>> AM> >> What's the Linux equivalent to SendMessage?
>> AM> > AM> > It doesn't exist. You cannot just send a newly constructed
>> AM> > key event back to the control under Linux (GTK+),
>>
>>  You can use EmulateKeyPress() method of wxTextCtrl. For the other 
>> controls
>> there is no way to do what you want.
> 
> At least, not with wxWidgets. However, you could use Xlib and make it 
> send a key to the focused window. It would go something like this:
> 
> Use XOpenDisplay to get connection to display, then use XGetInputFocus 
> to find the focused window (which is probably some Gtk control), and 
> setup XKeyEvent structure and send it with XSendEvent.

Thanks for your answer, Milan!
I'll try your suggestions!

Cheers,
Andreas






More information about the wx-users mailing list