Re: [gtk-list] Drawing Area in Scrolled Window



Hi,

Horst Piening <piening@dkrz.de> wrote:
>I have a scolled window containing a drawing area and would
>like to catch some key-events, but that doesn4t work.

I catch "event" in my app, and it works for keypresses. For example:

build()
{
        gtk_widget_set_events( GTK_WIDGET( drawing_area ),
                GDK_KEY_PRESS_MASK );
        gtk_signal_connect( GTK_OBJECT( drawing_area ), "event",
                GTK_SIGNAL_FUNC( event_cb ), iv );
        GTK_WIDGET_SET_FLAGS( GTK_WIDGET( drawing_area ), GTK_CAN_FOCUS );
}

static gint
event_cb( GtkWidget *widget, GdkEvent *event, ImageView *iv )
{
	switch( event->type ) {
	case GDK_KEY_PRESS:
                if( event->key.keyval >= 0x20 && event->key.keyval <= 0xFF )
                        printf( "I got a %c\n", event->key.keyval );
                else
                        printf( "I got some other key .. %d\n",
                                event->key.keyval );

		break;
	}
}

>would like to scroll the drawing area with the mouse.
>so i tried to change vertical & horizontal adjustments of the
>scrolled window in and emitted the "changed" signal, but
>there was no result.

Can't help here, sorry. Good luck - John
--
John Cupitt, john.cupitt@ng-london.org.uk, +44 (0)171 930 2108
VASARI Lab, The National Gallery, Trafalgar Square, London, WC2N 5DN



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