[Gtk-sharp-list] Overriding or new handler

Michael Gebhart lists at miketech.net
Fri Mar 10 12:48:21 EST 2006


Hi,

I have one question:

I wanna write a custom widget, that should handle requests. What is the
better way:

To override the methods:

                
    protected override bool OnButtonPressEvent(Gdk.EventButton evnt)
   {
        Console.WriteLine("Pressed");
        return true;
    }


Or adding a new handler:


    public MyWidget() 
     { 
            ButtonPressEvent += ButtonPressed; 
     } 
                                       
     public void ButtonPressed(object o, EventArgs args) 
     { 
           Console.WriteLine("Pressed"); 
     } 


Is there any advantage, or disadvantage?

Greetings

Mike



More information about the Gtk-sharp-list mailing list