grabbing arrow keys in Gtk::Window
- From: Emilian Nowak <emiml wp pl>
- To: gtkmm-list gnome org
- Subject: grabbing arrow keys in Gtk::Window
- Date: Mon, 21 Aug 2006 09:30:30 +0200
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).
I have attached simple test case for that. I was running it on gtkmm 2.8.8 and
pressing arrow key does nothing. I was expecting it to print "key pressed",
but something must be wrong here.
What is correct way to catch such key pressed events?
#include <gtkmm.h>
#include <iostream>
bool key_pressed_callback(GdkEventKey *ek) {
std::cout << "key pressed" << std::endl;
return true;
}
int main(int argc, char *argv[]) {
Gtk::Main app(&argc, &argv);
Gtk::Window win;
win.signal_key_press_event().connect(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]