[fpc-pascal]sendkeys with gtk binding

Marc Santhoff M.Santhoff at t-online.de
Sun Mar 14 15:03:13 CET 2004


Am So, den 14.03.2004 schrieb Michael.VanCanneyt at Wisa.be um 13:57:
> On Sun, 14 Mar 2004, Marc Santhoff wrote:
> 
> > Hi!
> > 
> > I'm trying to put some key event in the general message queue of an
> > application. Think of simulating key presses. Some keypresses should be
> > sent to the window and appear in the focussed widget.
> > 
> > On windows there is (or at least was years ago) the "sendkeys()"
> > function. 
> 
> This is actually a Visual Basic function :-)

Oops! Sounds like "Jehova" ;)

But i had a unit for Delphi some years ago doing this task. IIRC this
was Delphi 1 on win3.1 or Delphi 2.

> > Does the fcl or gdk/gtk-binding offer similar possibilities?
> 
> No. SendKeys() works by grace of sending windows messages to a window
> handle. You would need to find the right window handle and send an X event
> to it. But to my knowledge, GDK doesn't offer this possibility. I'm not an
> expert, though.
> 
> > 
> > Until now i found the function "gtk_signal_emit", but it only does
> > trigger registered events ... I'm stuck.
> 
> I don't think that you should look at the GTK level, but at the GDK level.
> Or even the X level.

You're right. In the GDK docs i found "gdk_event_put" which should do. I
did not have such nice access violation errors for a long time. =:-()
But it seems to be a lack of documentation.

I hoped for some sort of virtual keyboard stuff for fpc but found
nothing.

Thank you anyways,
Marc







More information about the fpc-pascal mailing list