Re: How to know when user pushes Del key ?
- From: Santhosh <santhoshmani gmail com>
- To: Colossus <colossus 3000 it>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: How to know when user pushes Del key ?
- Date: Sun, 26 Feb 2006 12:30:14 +0530
Hi Colossus,
You have to connect to the "widget's" key_press_event to check for the
required key...
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
g_signal_connect (widget, "key_press_event", G_CALLBACK
(widget_on_key_pressed), <your data>);
//callback
gboolean widget_on_key_pressed (GtkWidget* widget, GdkEventKey* event,
gpointer data)
{
g_return_val_if_fail (e != NULL, FALSE);
if (event->keyval == GDK_Backspace) { //put whatever key you wish
//do something
}
return TRUE/FALSE;
}
if you return TRUE, the signal will not be propogated.. I mean the
default handler(if there is any) for that key will not be called...
You can also refer:
http://cvs.sourceforge.net/viewcvs.py/eccvs/eccvs2/src/eccvs-browser.cpp?rev=1.5&view=markup
and search for "key_press_event"
Regards,
Santhosh.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]