Re: keyboard events



Ok, I'm trying with the signal, but I get a lot of errors.

where's what I'm doing:

my class inherits from Gtk::Window.

then on the constructor I have,
this->signal_key_release_event().connect ( sigc::mem_fun(*this,
&AnimeWindow::onKeyRelease) );

(here, I don't know if I have to send an argument?..)

and then my function:

void AnimeWindow::onKeyRelease(GdkEventButton *event)
{
cout << "key" << endl;
}

On Thu, Aug 25, 2011 at 8:17 PM, Yann LEYDIER <yann leydier info> wrote:
> Hi,
>
> signal_key_release_event() seems the right way to do it. For the list of key
> values, see gdk/gdkkeysyms.h as stated in Gtk's documentation :
> http://developer.gnome.org/gdk/stable/gdk-Event-Structures.html#GdkEventKey
>
> You could also derivate your class from Gtk::Dialog, which recieves a
> response when ESC is pressed.
>
> yann
>
> On 25/08/11 21:00, lecas malecas wrote:
>>
>> Hey, I have a window which I want to close when the esc key is
>> pressed, I've tried overriding the "virtual bool on_key_release_event
>> (GdkEventKey* event); " but I get some weird errors (also can't find
>> the documentation about GdkEventKey, to identify the keys). I tried
>> adding a function to the "signal_key_release_event()" but also get
>> some errors :)
>>
>> Can anyone tell me how to call a function when the esc key is pressed
>> (on a Gtk::Window derived class)?
>> _______________________________________________
>> gtkmm-list mailing list
>> gtkmm-list gnome org
>> http://mail.gnome.org/mailman/listinfo/gtkmm-list
>
> _______________________________________________
> 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]