Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2004-03

sendkeys with gtk binding

4 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Marc Santhoff

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. Does the fcl or gdk/gtk-binding offer similar possibilities?

Until now i found the function "gtk_signal_emit", but it only does trigger registered events ... I'm stuck.

Maybe this is more a gdk-qestion, but since I'm using fpc to write it I dare to ask here.

Bye,
Marc

Unknown author
to Marc Santhoff
Marc Santhoff wrote 8 lines
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 :-)

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.

Michael.

Marc Santhoff
to Unknown author
Show quoted text 12 lines
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.

Show quoted text 13 lines
> 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

Marc Santhoff
to Marc Santhoff

Am So, den 14.03.2004 schrieb Marc Santhoff um 15:03: [...]

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.

In fact the right function is: gtk_propagate_event()

This does work as expected. The only thing to mention is that the focus has to be at the receiving widget.

Bye,
Marc