Re: grabbing arrow keys in Gtk::Window
- From: Paul Davis <pjdavis engineering uiowa edu>
- To: gtkmm-list gnome org
- Subject: Re: grabbing arrow keys in Gtk::Window
- Date: Mon, 21 Aug 2006 07:02:27 -0500
Forgot to CC the list.
Paul Davis wrote:
Emilian,
http://marc.theaimsgroup.com/?l=gtkmm&m=107536876400434&w=2
Using connect_notify( ... ) works.
Emilian Nowak wrote:
Hello,
I'm trying to grab key press event inside Gtk::Window
I made a signal handler for signal_key_press_event(), but this signal is
emitted when I press keys != (arrow keys).
[Snip]
Working example:
#include <gtkmm.h>
#include <iostream>
void key_pressed_callback(GdkEventKey *ek) {
std::cout << "key pressed" << std::endl;
}
int main(int argc, char *argv[]) {
Gtk::Main app(&argc, &argv);
Gtk::Window win;
win.add_events( Gdk::BUTTON_PRESS_MASK ) ;
win.signal_key_press_event().connect_notify(sigc::ptr_fun(&key_pressed_callback));
app.run(win);
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]