Re: [gtk-list] Esc key?
- From: Thomas Mailund Jensen <mailund daimi aau dk>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Esc key?
- Date: 24 Jul 1998 21:54:24 +0200
>>>>> "J" == Jan Sochman <jena@artax.karlin.mff.cuni.cz> writes:
J> Hi, I'd like to close my windows when Esc key is pressed. Do you
J> have any idea how to do it?
Try something like:
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <gdk/gdkkeysyms.h>
static gboolean
key_press (GtkWidget *win, GdkEventKey *ev)
{
if (ev->keyval == GDK_Escape) {
gtk_widget_destroy (win);
}
return FALSE;
}
int
main (int argc, char *argv[])
{
GtkWidget *window;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_signal_connect (GTK_OBJECT (window), "key_press_event",
GTK_SIGNAL_FUNC (key_press),
NULL);
gtk_widget_show (window);
gtk_main ();
}
/mailund
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]