How does 'on_key_press_event' work in 'Gtk::Entry' ?
- From: "Søren Hauberg" <hauberg gmail com>
- To: gtkmm-list gnome org
- Subject: How does 'on_key_press_event' work in 'Gtk::Entry' ?
- Date: Sun, 30 Mar 2008 13:36:12 +0200
Hi All,
I'm new to GUI programming in general and specifically GTKmm, so
bare with me...
I'm experimenting with Gtk::Entry, and I would like the following behaviour
If the user presses TAB, UP, or DOWN, print the key name to stdout.
Otherwise act as normal, that is, show the key in the text entry.
Should be simple. So my widget 'GUI_input' inherits from Gtk::Entry,
and implements the following the 'on_key_press_event' function as
follows:
bool GUI_input::on_key_press_event (GdkEventKey* event)
{
bool handled = false;
switch (event->keyval)
{
case GDK_Tab:
std::cout << "TAB: " << std::endl;
handled = true;
break;
case GDK_Up:
std::cout << "UP: " << std::endl;
handled = true;
break;
case GDK_Down:
std::cout << "Down: " << std::endl;
handled = true;
break;
}
return handled;
}
This behaves as follows:
If the user presses TAB, UP, or DOWN, print the key name to stdout.
Otherwise don't show anything in the text entry.
Can anybody give me a hint as to what I should do?
Thanks,
Søren
P.S. And thanks for creating such a nice library. In general things
are very intuitve.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]