Re: How to simulate keypress event for "page down" keyboard button ?
- From: Sergio Perticone <g4ll0ws gmail com>
- To: gtkmm mailing-list <gtkmm-list gnome org>
- Subject: Re: How to simulate keypress event for "page down" keyboard button ?
- Date: Fri, 22 Jun 2007 15:59:32 +0200
Govinda Parida wrote:
Hi, I have added a Gtk::TreeView control in a Gtk::Window and at the
right side of the treeview, I have added a Gtk::Button. when this button
is clicked the keypress event to the "page down" key should be generated
to view the next page of treeview. How do I generate keypress event for
"page down" key. please give me some clues.
You have to create a GdkEventKey, something like that:
void Foo:bar() // handler for signal_clicked()
{
<YOUR TREEVIEW>.grab_focus(); // essential
guint keyval = GDK_Page_Down;
GdkKeymapKey* keys;
gint n_keys;
gdk_keymap_get_entries_for_keyval(gdk_keymap_get_default(),
keyval,
&keys,
&n_keys);
// Note: GdkEvent is an union
GdkEvent* event = gdk_event_new(GDK_KEY_PRESS);
((GdkEventKey*)event)->window =
<YOUR TREEVIEW>get_window()->gobj();
((GdkEventKey*)event)->send_event = TRUE;
((GdkEventKey*)event)->time = GDK_CURRENT_TIME;
((GdkEventKey*)event)->state = GDK_KEY_PRESS_MASK;
((GdkEventKey*)event)->keyval = keyval;
((GdkEventKey*)event)->hardware_keycode = keys[0].keycode;
((GdkEventKey*)event)->group = keys[0].group;
gdk_event_put(event);
// Or, more gdkmm-ish:
// Gdk::Event(event).put();
}
Anyway it's GDK stuff, I don't know how to do that in gdkmm..
Take a look to GDK reference for more info.
Regards,
s.
------------------------------------------------------------------------
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]