Re: [Vala] Why is my menubar not showing up?



Yes,

Sorry, that was the first try, of course, but that also doesn't work. Code:

using Gtk;

class menusystem : Gtk.Window
{
    public menusystem ()
    {
        this.title = "Menu System Demo";
        this.destroy.connect (Gtk.main_quit);
        set_default_size (600, 600);
                                
        var menubar = new MenuBar();
        var file_menu = new Menu();
        var quit_item=new MenuItem.with_mnemonic("_Quit");
        file_menu.append(quit_item);
        quit_item.activate.connect(Gtk.main_quit);
        var file_launcher=new MenuItem.with_mnemonic("_File");
        file_launcher.set_submenu(file_menu);
        menubar.append(file_launcher);

        var vbox = new VBox (false, 0);
        vbox.pack_start (menubar,false,false,0);
        add (vbox);
    }

    static int main (string[] args)
    {
        Gtk.init (ref args);

        var mymenu = new menusystem ();
        mymenu.show_all();

        Gtk.main ();

        return 0;
    }
}


Greetz,
Fred



2011/7/29 Iven Hsu <ivenvd gmail com>:
I think you should add(vbox), instead of add(menubar).

2011/7/30 Fred van Zwieten <fvzwieten gmail com>

Hi.

I try to make a menubar, taking examples from vala toolbar demo and a
pygtk tutorial. I have this sample code:

using Gtk;

class menusystem : Gtk.Window
{
   public menusystem ()
   {
       this.title = "Menu System Demo";
       this.destroy.connect (Gtk.main_quit);
       set_default_size (600, 600);

       var menubar = new MenuBar();
       var file_menu = new Menu();
       var quit_item=new MenuItem.with_mnemonic("_Quit");
       file_menu.append(quit_item);
       quit_item.activate.connect(Gtk.main_quit);
       var file_launcher=new MenuItem.with_mnemonic("_File");
       file_launcher.set_submenu(file_menu);
       menubar.append(file_launcher);

       var vbox = new VBox (false, 0);
       vbox.pack_start (menubar,false,false,0);
       add (menubar);
   }

   static int main (string[] args)
   {
       Gtk.init (ref args);

       var mymenu = new menusystem ();
       mymenu.show_all();

       Gtk.main ();

       return 0;
   }
}

The menubar doesn't show up. Why not?

Greetz,
Fred
_______________________________________________
vala-list mailing list
vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]