Gtkmozembed ctrl-A

I have an application that has gtkmozembed in it. When I press
control-A, the entire page is selected. Great. I would like for that
same action to take place when the user presses a “select all” button.

There should be something to emit a keystroke programmatically. Can
someone point me in the right direction?

Thanks,
Alan


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

Hi,

On Thu, Mar 29, 2007 at 01:57:42AM +0300, Alan L. wrote:

There should be something to emit a keystroke programmatically. Can
someone point me in the right direction?

I don’t know if gtkmozembed has a method for that, but here’s a little
code
snippet to synthesize key events:

module Gtk
class Widget
def send_key(name)
keyval = Gdk::Keyval.from_name(name)
unless keyval.zero?
event = Gdk::EventKey.new(Gdk::Event::KEY_PRESS)
event.window = window
event.hardware_keycode =
Gdk::Keymap.default.get_entries_for_keyval(keyval)[0][0]
event.keyval = keyval
event.time = Gtk.current_event_time
Gtk.idle_add do
self.event(event)
false
end
return true
else
return false
end
end
end
end

With this loaded you can call send_key on any Gtk::Widget, and pass in
a keyname as the first parameter (e.g. ‘a’). You need to extend this a
bit to
also allow Ctrl, I think it involves setting a mask on event.state.

I’m not sure if this method is sane, but it works fine here. I think
it didn’t work quite right without the Gtk.idle_add call, but you should
first try without it and see if it does in your app.

Also, it’s possible this doesn’t work with gtkmozembed, I remember
trying
to connect mouse signals, which isn’t supported.

Thanks,
Alan

Cheers,
Markus


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

I have decided to write documentation for ruby-gnome2.

I am going to follow the model used at
TinyButStrong. Of course my documentation
project will be written with RoR. The examples in the left panel of the
TBS site will be an iteration of a project to use the different features
of ruby-gnome2. Obviously, I’ll have to use other parts of Gtk2 as
well.

I have a lot of work to do before there will be any code released, but I
will release all of my work as soon as I have anything to show.

I’m an experienced programmer and documentation writer, but a beginner
with Ruby, so this is a very large project for me. I’d appreciate any
advice (except the advice to quit), code snippets, explanations, etc.
that you’d care to give to help shorten my learning curve / development
time.

Regards,
Alan L.


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV