[Lazarus] How send key events to a control with XSendEvent (without libXtst)

zeljko zeljko at holobit.net
Sun Oct 17 10:02:22 CEST 2010


On Saturday 16 October 2010 05:34, fluisgirardi at gmail.com wrote:
> Hi!
>
> I'm studding a way to create applications for touch screens. Sometimes
> I need enter data, but I don't have keyboard installed, so I searched
> a way to send key events to the control and I found the lazarus
> example mouseandkeyborardinput but it don't work very well (In the
> example it keeps the last char pressed and I don't know if it's
> application bug or libXtst) and it's linked with a library that isn't
> installed on Linux systems by default (on ubuntu I installed the
> libxtst-dev to get it working).
>
> As an alternate way, I found the XSendEvent and XKeyEvent. My Question
> is: How fill the following record items to get it working at least
> with Gtk2/Qt?
>
>
> I wrote this piece (that don't works :) )
>
> procedure TForm1.Button1Click(Sender: TObject);
> var
>   vx:TXKeyEvent;
> begin
>   vx.display:=XOpenDisplay(nil);
>   vx.window:= QWord(GTK_WINDOW(Pointer(edit1.Handle)));
>   vx.root  := RootWindow(vx.display,DefaultScreen(vx.display));
>
>
> Somebody?

I've already implemented virtual keyboard in some of our commercial apps , 
using qt and sending events about key pressed. So, I'm creating and sending 
pure Qt event. Gtk will not work with this, but I don't care.

zeljko





More information about the Lazarus mailing list