GLib.ConnectBeforeAttribute Class
Identifies a delegate to run before the default signal handler.

See Also: ConnectBeforeAttribute Members

Syntax

public sealed class ConnectBeforeAttribute : Attribute

Remarks

Use this attribute to attach an event handler to an object and cause it to be invoked before the default signal handler of the object. While this mechanism can be used to pierce the object's encapsulation and change the behavior of the object without subclassing it, the cleaner approach would be to subclass the object and override the virtual method for the default signal handler.

In the following example, the ButtonClicked method will be invoked before the Gtk.Button.OnClicked virtual method is executed.

C# Example

public class Example {
	public static int Main (string[] args)
	{
		Gtk.Button btn = new Gtk.Button ("Click me");
		btn.Clicked = new EventHandler (ButtonClicked);
	}

	[GLib.ConnectBefore]
	private void ButtonClicked (object o, EventArgs args)
	{
		Console.WriteLine ("Got Clicked");
	}
}
  

Requirements

Namespace: GLib
Assembly: glib-sharp (in glib-sharp.dll)
Assembly Versions: 2.12.0.0