Hi,

Put the label in a EventBox, like this:

Label statuslabelconnexion = new Label("Active Connection:");
EventBox ebox = new EventBox ();
ebox.Add (statuslabelconnexion);
ebox.ButtonPressEvent += OnLabelButtonPressEvent;
statusbar.PackStart(ebox, false, false, 0);

And it should work for you!

/Fredrik


mån 2005-07-11 klockan 23:35 +0200 skrev [EMAIL PROTECTED]:
> Hello,
> 
> I'm trying to make an Popup when right click is pressed on a Label.
> As show in the code below, the label "statuslabelconnexion" is pack in a 
> statusbar, same for the image.
> I have made two events but i don't received any!
> Could you help, please?
> 
> private Gui()
> {
>  /// Code...
> statusbar = new Statusbar ();
> statusbar.Push (1, "Ready.");
> statusbar.Homogeneous = false;
> Label statuslabelconnexion = new Label("Active Connection:");
> statuslabelconnexion.ButtonPressEvent += new ButtonPressEventHandler          
>        (OnLabelButtonPressEvent);
> statuslabelconnexion.PopulatePopup += new PopulatePopupHandler 
> (PopupPopupConnexion); 
> statusbar.PackStart(statuslabelconnexion, false, false, 0);
> Gtk.Image image1 = new Gtk.Image(Stock.No, Gtk.IconSize.SmallToolbar);
> statusbar.PackStart(image1, false, false, 0);
> }
> 
> private void OnLabelButtonPressEvent(object o, ButtonPressEventArgs args)
> {
>       Gdk.EventButton eb = args.Event;
>       #if ( DEBUG )
>               Console.WriteLine ("Button OnLabelButtonPressEvent click");
>       #endif
>        switch (args.Event.Button)
>            {
>                case 3:
>                       PopupPopupConnexion2(args.Event);
>                        break;
>                       case 1:
>                       #if ( DEBUG )
>                    Console.WriteLine ("First OnLabelButtonPressEvent click");
>                       #endif
>                       break;
>             } 
> }
>               
> private void PopupPopupConnexion(object o, PopulatePopupArgs args)
> {
>       #if ( DEBUG )
>               Console.WriteLine ("In PopupPopupConnexion!");
>            #endif
>       PopupPopupConnexion2(null);
> }
>               
> private void PopupPopupConnexion2 (EventButton ev)
> {
>               #if ( DEBUG )
>               Console.WriteLine ("In PopupPopupConnexion2!");
>         #endif
> }
> 
> -------------------------------------------------------------
> NetCourrier, votre bureau virtuel sur Internet : Mail, Agenda, Clubs, 
> Toolbar...
> Web/Wap : www.netcourrier.com
> Téléphone/Fax : 08 92 69 00 21 (0,34 € TTC/min)
> Minitel: 3615 NETCOURRIER (0,16 € TTC/min)
> 
> _______________________________________________
> Gtk-sharp-list maillist  -  [email protected]
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
> 

_______________________________________________
Gtk-sharp-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

Reply via email to