[Gtk-sharp-list] Why "mniEditar" (MenuItem) does not show?

Carlos Adriano Portes xcap2000 at gmail.com
Wed Jan 31 19:04:00 EST 2007


As I am new to gtk#, where is my mistake?

using Gtk;
using System;

namespace Estudo
{
	public class MainClass
	{
		public static void Main(string[] args)
		{
			Application.Init();
			FrmPrincipal frmPrincipal = new FrmPrincipal("Teste");
			frmPrincipal.Show();
			Application.Run();
		}	
	}
	public class FrmPrincipal: Window
	{
		HBox hboPrincipal;
		
		MenuBar mnbPrincipal;
		
		Menu mnuArquivo;
		MenuItem mniArquivo;
		MenuItem mniNovo;
		MenuItem mniSair;
		
		Menu mnuEditar;
		MenuItem mniEditar;
		MenuItem mniCopiar;
		MenuItem mniRecortar;
		MenuItem mniColar;
		
		public FrmPrincipal(string Text): base(Text)
		{
			hboPrincipal = new HBox();
			
			mnbPrincipal = new MenuBar();

			mnuArquivo = new Menu();

			mniArquivo = new MenuItem("Arquivo");
			mniNovo = new MenuItem("Novo");
			mniSair = new MenuItem("Sair");

			mnuArquivo.Append(mniNovo);
			mnuArquivo.Append(mniSair);
			
			mniArquivo.Submenu = mnuArquivo;
			
			mnuEditar = new Menu();

			mniEditar = new MenuItem("Editar");
			mniCopiar = new MenuItem("Copiar");
			mniRecortar = new MenuItem("Recortar");
			mniColar = new MenuItem("Colar");
			
			mnuEditar.Append(mniCopiar);
			mnuEditar.Append(mniRecortar);
			mnuEditar.Append(mniColar);
			
			mniEditar.Submenu = mnuEditar;
			
			mnbPrincipal.Append(mniArquivo);
			mnbPrincipal.Append(mnuEditar);
			
			hboPrincipal.PackStart(mnbPrincipal);
			
			this.Add(hboPrincipal);
			this.ShowAll();
		}
		public void OnDeleteEvent(object o, EventArgs args)
        {
        	Application.Quit();
        }
	}
}

Thanks in advance.


More information about the Gtk-sharp-list mailing list