Discussion:
[Java-gnome-developer] How to send key press event using java?
Niranjan Rao
2013-01-21 01:38:54 UTC
Permalink
Greetings,

I would like to do something similar to
http://stackoverflow.com/questions/6796191/how-to-send-key-events-to-webkit-webview-control
or similar to copied answer from stack overflow question. I could see
the handlers for receiving events, but could not see anything that can
emit the events. How can I achieve this?

event = gtk.gdk.Event(gtk.gdk.KEY_PRESS)
event.keyval = gtk.keysyms.Return
event.time = 0
browser.emit('key-press-event', event)


Regards,

Niranjan
Andrew Cowie
2013-01-21 03:37:47 UTC
Permalink
<http://java-gnome.sourceforge.net/doc/api/4.1/org/gnome/gtk/Test.html#sendKey(org.gnome.gtk.Widget, org.gnome.gdk.Keyval, org.gnome.gdk.ModifierType)>

might be what you want, though, as mentioned that's very much for
testing.

If you're trying to "make something happen" that's bound to a keystroke,
then you might be better off with Actions and triggering the action()
directly.

AfC
Sydney
Niranjan Rao
2013-01-21 19:01:05 UTC
Permalink
Post by Andrew Cowie
<http://java-gnome.sourceforge.net/doc/api/4.1/org/gnome/gtk/Test.html#sendKey(org.gnome.gtk.Widget, org.gnome.gdk.Keyval, org.gnome.gdk.ModifierType)>
might be what you want, though, as mentioned that's very much for
testing.
If you're trying to "make something happen" that's bound to a keystroke,
then you might be better off with Actions and triggering the action()
directly.
AfC
Sydney
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
http://p.sf.net/sfu/learnmore_122412
_______________________________________________
java-gnome-developer mailing list
https://lists.sourceforge.net/lists/listinfo/java-gnome-developer
Thank you. As you mentioned I am trying to "make something happen".
Unfortunately call is deep inside webkit and webkit gtk does not expose
any API for that. Right now only way seems to be sending key/mouse
events but I'll keep investigating.

Regards,

Niranjan

Loading...