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

See Also: ConnectBeforeAttribute Members


public sealed class ConnectBeforeAttribute : Attribute


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);

	private void ButtonClicked (object o, EventArgs args)
		Console.WriteLine ("Got Clicked");


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