Hi,

I saw that some people had the similar problem but coulnd't get it 
fixed. Anyone got any ideas?

RvdKorput wrote:
> Hi,
>
> I'm currently working on a program for viewing object with openGL but 
> im experiencing problems with the "on_key_press_event" on a 
> Gtk::DrawingArea. I'm currently loading a window with glade with a 
> HBox on it. From there on I create a Gtk::DrawingArea widget (the 
> opengl viewport) and add it to the HBox, so only the HBox is loaded 
> from glade.
>
> The problem is that my keyboard input doesn't reach the 
> Gtk::DrawingArea. Other input like mouse movement and button press 
> event, I can receive.
>
> Some example code:
>
> In the header file of the TGTKGLViewport (that inherets of 
> Gtk::DrawingArea):
> protected:
>    virtual void on_realize();
>    virtual bool on_expose_event(GdkEventExpose* data);
>    virtual bool on_button_press_event(GdkEventButton* eventData);
>    virtual bool on_button_release_event(GdkEventButton* eventData);
>    virtual bool on_motion_notify_event(GdkEventMotion* eventData);
>    virtual bool on_key_press_event(GdkEventKey* eventData);
>
> In the CPP file
>
> TGTKGLViewport::TGTKGLViewport(uint width, uint height)
> :    TGTKGLWidget(width, height)
> ,    m_Camera(NULL)
> {
>    this->set_events(
>        Gdk::BUTTON_PRESS_MASK |    //mouse button down
>        Gdk::BUTTON_RELEASE_MASK |    //mouse button up
>        Gdk::POINTER_MOTION_MASK);    //mouse pointer move
>    this->add_events(Gdk::KEY_PRESS_MASK);        //Keyboard input
>
>    this->set_flags(Gtk::CAN_FOCUS);
> }
>
> bool TGTKGLViewport::on_key_press_event(GdkEventKey* eventData)
> {
>    OutputDebugString("Keyboard input viewport\n");
>    return true;
> }
>
> I've got the feeling the window isn't passing the event to the 
> TGTKGLViewport. but how can i reach that?
> I tried to add the TGTKViewport to the window manually but only get 
> warning that it already has a parent.
>
> Thanks in advance,
>
> Roy van de Korput
>

_______________________________________________
gtkmm-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to