[Gtk-sharp-list] Label PopulatePopup

underdog10 at netcourrier.com underdog10 at netcourrier.com
Tue Jul 12 08:26:30 EDT 2005


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 an EventBox, and the image to the StatusBar.

When discuting on the list, it appear that you need to set an eventbox to te label before add event, but it does'nt work?

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:");
 EventBox ebox = new EventBox ();
 ebox.Add (statuslabelconnexion);
 ebox.ButtonPressEvent += OnLabelButtonPressEvent;
 ebox.PopulatePopup += PopupPopupConnexion;
 statusbar.PackStart(ebox, 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)



More information about the Gtk-sharp-list mailing list