[Gtk-sharp-list] Cancelling events

Mike Kestner mkestner@ximian.com
Fri, 20 Feb 2004 11:21:04 -0600

On Fri, 2004-02-20 at 07:57, Iain McCoy wrote:
> Hey folks,
> I've been diving into using druid's with gtk#, and there doesn't seem to
> be a way to cancel events. When the DruidPage emits a NextClicked
> signal, I want to set the Druid's Page property (it's a non-linear
> druid) and cancel the event. I believe that with gtk in C, I could just
> make my event handler return false. However, all the relevant delegates
> don't return anything in gtk#, so obviously that's not it. I looked up
> the way System.Windows.Forms does it, and cancelable events in that
> world have a Cancel member in their EventArgs that can be set to true,
> but gtk# doesn't appear to do things that way either.
> How is a user of gtk# supposed to cancel an event?

Gnome.DruidPage.NextClicked is mapped internally to a
boolObjectObjectSignal, which passes SignalArgs.RetVal back to Gtk+
after your delegate runs.  So, by setting args.RetVal in your delegate,
you are effectively returning that value to Gtk+.

Mike Kestner <mkestner@ximian.com>