Only to register how solve this (GTK2)
procedure TForm2.SpeedButton7Click(Sender: TObject); var vx:TXEvent; begin vx.xkey.display := GDK_WINDOW_XDISPLAY(PGtkWidget(Ftarget.Handle)^.window); vx.xkey.window := GDK_WINDOW_XWINDOW(PGtkWidget(Ftarget.Handle)^.window); vx.xkey.root := RootWindow(vx.xkey.display,0); vx.xkey.subwindow := 0; vx.xkey.time := 5; vx.xkey.x := 1; vx.xkey.y := 1; vx.xkey.x_root := 1; vx.xkey.y_root := 1; vx.xkey.same_screen := 1; vx.xkey._type := x.KeyPress; vx.xkey.keycode := XKeysymToKeycode(vx.xkey.display,Ord((Sender AS TSpeedButton).Caption[1])); vx.xkey.state := 0; XSendEvent (vx.xkey.display,vx.xkey.window,true,x.KeyPressMask,@vx); vx.xkey._type:=x.KeyRelease; XSendEvent (vx.xkey.display, vx.xkey.window,true,x.KeyReleaseMask, @vx); end; 2010/10/16 [email protected] <[email protected]>: > 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? > > > Regards, > > Fabio > -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
