How to get keybaord input to work on a drawingarea



I'm pulling my heair out when trying to get my application (using
GKT+20 and gtkgtlext 1.0.5)
to accept keyboard input on a drawingarea window.    I've tried setting
the event mask to all events, tried throwing hte drawing area inside
and ebox and enable all events for both widgets and still do NOT get
any keyboard input events on the drawingarea.

The code in question is:

drawing_area = gtk_drawing_area_new();
        gtk_container_add(GTK_CONTAINER(frame),drawing_area);

        gtk_widget_set_size_request (drawing_area,
                        DEFAULT_WIDTH, DEFAULT_HEIGHT);
        gl_config = get_gl_config();
        gtk_widget_set_gl_capability(drawing_area, gl_config, NULL,
                        TRUE, GDK_GL_RGBA_TYPE);
        gtk_widget_add_events (drawing_area,
                        GDK_BUTTON1_MOTION_MASK |
                        GDK_BUTTON2_MOTION_MASK |
                        GDK_BUTTON_PRESS_MASK   |
                        GDK_KEY_PRESS_MASK      |
                        GDK_KEY_RELEASE_MASK    |
                        GDK_FOCUS_CHANGE_MASK   |
                        GDK_VISIBILITY_NOTIFY_MASK);

        /* Connect signal handlers to the drawing area */
        g_signal_connect_after(G_OBJECT (drawing_area), "realize",
                        G_CALLBACK (tuning_gui_realize), NULL);
        g_signal_connect(G_OBJECT (drawing_area), "configure_event",
                        G_CALLBACK (tuning_gui_configure_event), NULL);
        g_signal_connect(G_OBJECT (drawing_area), "expose_event",
                        G_CALLBACK (tuning_gui_expose_event), NULL);
        g_signal_connect (G_OBJECT (drawing_area),
"motion_notify_event",
                        G_CALLBACK (tuning_gui_motion_notify_event),
NULL);
        g_signal_connect (G_OBJECT (drawing_area),
"button_press_event",
                        G_CALLBACK (tuning_gui_button_press_event),
NULL);
        g_signal_connect(G_OBJECT (drawing_area), "key_press_event",
                        G_CALLBACK (tuning_gui_key_press_event), NULL);

The tuning_gui_key_press_event() function NEVER gets called..

NOTE:  This window being drawn on is a page of a notebook, and being
able to use the arrow keys inside the drawing area is preferred,  but
the notebook always catches the arrow keys..


=====
Dave J. Andruczyk

__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/



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