Re: [gtk-list] Key press event in drawing area
- From: Brandon Long <blong fiction net>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Key press event in drawing area
- Date: Wed, 18 Nov 1998 14:31:52 -0800
On 11/18/98 Guzma Vladimir uttered the following other thing:
> Hi all
> I want to have drawing area with something write in it and I need to get key pres even for this
> Ho to get them??
You have to both allow the events, and set up a handler for the keypress
event, something like:
da = gtk_drawing_area_new ();
/* some code to place da */
/* Connect your callback to the signal */
gtk_signal_connect (GTK_OBJECT (da), "key_press_event",
(GtkSignalFunc) keypress_callback, NULL);
/* Unmask the signal */
/* You'll probably want to or this with the other events you want,
* typically you should grab the GDK_EXPOSURE_MASK as well for a drawing
* area */
gtk_widget_set_events (da, GDK_KEY_PRESS_MASK | GDK_EXPOSURE_MASK);
gtk_widget_show (da);
Then, you define your callback like:
gint entry_callback (GtkWidget *w, GdkEventKey *event, gpointer data)
{
g_print ("-I- Key Press %s\n", event->string);
}
Brandon
--
Brandon Long (blong@fiction.net) [http://www.fiction.net/blong/]
"The 'Christian Coalition' gives a bad name to both Christians and
coalitions." -- Her Grace the Duchess, Bonni Hall
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]