Gnome.Popup Class
Create and display popup and context menus.

See Also: Popup Members

Syntax

public class Popup

Remarks

Example

Example

using System;
using Gtk;
using GtkSharp;
using Gnome;

class PopupSample
{
	Program program;
	
	static void Main (string[] args)
	{
		new PopupSample (args);
	}
	
	PopupSample (string[] args)
	{
		program = new Program ("PopupSample", "0.0", Modules.UI, args);
		
		App app = new App ("PopupSample", "Gnome.Popup sample");
		app.SetDefaultSize (400, 300);
		app.DeleteEvent += new DeleteEventHandler (OnAppDelete);
		
		Menu menu = new Menu ();
		MenuItem hello = new MenuItem ("Hello");
		hello.Activated += new EventHandler (OnHelloActivated);
		hello.Show ();
		menu.Append (hello);
		
		Label label = new Label ("Right Click me");
		EventBox eventbox = new EventBox ();
		eventbox.Add (label);
		
		app.Contents = eventbox;
		
		Popup.MenuAttach (menu, eventbox, IntPtr.Zero);
		
		app.ShowAll ();
		program.Run ();
	}
	
	private void OnHelloActivated (object o, EventArgs args)
	{
		Console.WriteLine ("Hello Activated");
	}
	
	private void OnAppDelete (object o, DeleteEventArgs args)
	{
		program.Quit ();
	}
}
	  

Requirements

Namespace: Gnome
Assembly: gnome-sharp (in gnome-sharp.dll)
Assembly Versions: 2.20.0.0