Re: how to cancel an event?



kyanh o2 pl wrote:
Hi,

please help me: for a special purpose, i want to ignore some events. For example, in my multiline text editor, the keys Key Up and Key Down must be ignored in some cases.

I tried but failed. Thank you very much for replying.

Hello,

1) If you want to completely ignore some key events you may use key snooper. It's very easy to set/remove it and you will be sure that no one widget will get these events.

2) If you want to ignore key events for special widget only you can set a filter on "key-press-event", like the Jean and Carlo said. But this can be somewhat painful, because of many possible tricks. Like the case when widget has some logic on "key-release-event" or another signal handler that runs before yours...

http://developer.gnome.org/doc/API/2.0/gtk/gtk-General.html#gtk-key-snooper-install
http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html#GtkWidget-key-press-event
http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html#GtkWidget-key-release-event

	Olexiy




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