Re: Plug and socket communication.



Hi Germain,

I've done this in one program.  Key presses need:
1 ) a connection to the signal_key_press_event- eg

signal_key_press_event().connect(sigc::mem_fun(*this,&Window::key_pressed),false);

2) somewhere to recognise the keys:

bool Window::key_pressed(GdkEventKey *event)
{
  ...
    switch (event->keyval)
    {
        case 65362:
            Current_dir = _UP;
            break;
       case 65364:
            Current_dir = _DOWN;
            break;
        case 65361:
            Current_dir = _LEFT;
            break;
        case 65363:
            Current_dir = _RIGHT;
            break;
       default:
            std::cout<<"That hurt!"<<std::endl;
            break;

...
}

In Linux, <xev> in a terminal will show the output of any keypress you provide, so is good for figuring out what the event code is.

Ian


From: Germán Diago <germandiago gmail com>
To: gtkmm-list gnome org
Sent: Wednesday, 23 September, 2009 2:44:24 AM
Subject: Re: Plug and socket communication.

I tried to do the following, in this order:

1.- Connect to the socket's signal_key_press_event a handler.
2.- As it didn't work, I tried to set_events(Gdk::KEY_PRESS_MASK |
Gdk::KEY_PRESS_RELEASED)
3.- Tried to use a Gtk::EventBox and put the socket inside it.


None of them worked. It is as if the application didn't know anything
about my key presses.
Any help is appreciated. Bye and thanks!!
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list


Get more done like never before with Yahoo!7 Mail. Learn more.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]