Re: EventBox doesn't emit Key Events.
- From: Sergio Perticone <g4ll0ws gmail com>
- To: joaquinduran adtelecom es
- Cc: list gtkmm <gtkmm-list gnome org>
- Subject: Re: EventBox doesn't emit Key Events.
- Date: Tue, 30 Oct 2007 11:52:56 +0100
On Tue, 2007-10-30 at 11:50 +0100, Joaquim Duran wrote:
> Dear All,
>
> I'm interested in capture the key press event emitted by an Event Box
> container.
>
> I've modified the eventbox sample included in the GTKmm box to accept
> button pressed events and key pressed events. The result is the button
> pressed events are emitted (the window is closed), but not the key
> pressed events (the window is not closed).
>
> I've no idea if I'm doing something wrong or if this is a bug from the
> library.
>
> Gtkmm: 2.12.1
> Gtk: 2.12.1
> Glib: 2.14.2
>
> Thanks in advance.
>
> Thanks and Best Regards,
> Joaquim Duran
I use Window to catch that event... so:
ExampleWindow::ExampleWindow()
{
// ...
set_events(Gdk::KEY_PRESS_MASK);
signal_key_press_event().connect(
sigc::mem_fun(*this, &ExampleWindow::on_key_press) );
// ...
}
bool ExampleWindow::on_key_press(GdkEventKey* ev)
{
if (ev->keyval == GDK_Escape)
hide();
else
return false;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]