Gtk # distinguishes Widgets and Containers. Most widgets hosted on the Gtk # form will NOT receive mouse click events. To receive a mouse event, you need to place the widget inside a specific container - for example, EventBox:
Add an EventBox formula to the form. You can place it behind other widgets or, since it does not appear, unless you specifically select it (or change its background color).
Place your tag widget inside this EventBox. Note that the label will receive the shape and size of the EventBox.
Add to this EventBox the โButtonPressEventโ signal from the โCommon Widget Signalsโ.
If you need to identify the button that was pressed during the processing of this event, use the uint value in: args.Event.Button usually โ1โ will be the left mouse button, โ2โ will be the center button and โ3โ, the right button (โ2โ can also be by pressing the left and right buttons).
source share