[Gtk-sharp-list] Help with menus

Patrik Olterman patrik@olterman.se
17 May 2003 17:50:57 +0200

Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Ok finally have some compiled code with a menu, is there someone that
could take a minute and tell me what this does step by step .. the part
I am confused about is the actual packing of the window .. what goes
where and why ... this code compiles but why ? :)=20

 // widgets                                                      =20
      Window win =3D new Window ("Menu Sample App");
      VBox box =3D new VBox (false, 2);
      Button btn =3D new Button ("Yep, that's a menu");

      MenuBar mb =3D new MenuBar ();
      Menu file_menu =3D new Menu ();
      MenuItem exit_item =3D new MenuItem("Exit");
      MenuItem test_item =3D new MenuItem("Test");
      MenuItem file_item =3D new MenuItem("File");

      //handlers                                                       =20
      win.DeleteEvent +=3D new DeleteEventHandler (delete_cb);
      exit_item.Activated +=3D new EventHandler (exit_cb);
      test_item.Activated +=3D new EventHandler (test);

      	// packing this
	// part is very
	// confusing                                                   =20
      file_menu.Append (exit_item);
      file_menu.Append (test_item);
      file_item.Submenu =3D file_menu;
      mb.Append (file_item);
      box.PackStart(mb, false, false, 0);
      box.PackStart(btn, true, true, 0);
      win.Add (box);

      // show                                                         =20
      win.ShowAll ();

On Sat, 2003-05-17 at 17:30, Richard Torkar wrote:
> On Sat, 2003-05-17 at 17:13, Patrik Olterman wrote:
> > When I try to compile that example I get the following error=20
> >=20
> > /home/olterman/code/C-Sharp/Menu.cs(10) error CS0246: The namespace
> > `System.Drawing' can not be found (missing assembly reference?)
> > Compilation failed: 1 error(s), 0 warnings
> >=20
> >=20
> [xyz@~/install/gtk-sharp/sample]$ mcs /r:gtk-sharp /r:glib-sharp \
> /r:System.Drawing Menu.cs
> =EF=BB=BFCompilation succeeded
> /Richard

Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

Version: GnuPG v1.2.2 (GNU/Linux)