Re: [Vala] getting started with vala and glade




 
      From: Chris Bare <chris bare gmail com>
 Subject: [Vala] getting started with vala and glade
   
I have a very simple vala program that is trying to load a glade ui file.
The window appears briefly, but then the program exits without error.
What am I missing?


You need to add the ApplicationWindow to your Application. So add "this.add_window( window );":
using Gtk;

public class Thelma : Gtk.Application {
    protected override void activate () {
        var builder = new Builder ();
        builder.set_application( this );
        builder.add_from_file ("test.ui");
        var window = builder.get_object ("mainWindow") as ApplicationWindow;
        window.show_all ();
        this.add_window( window );
    }
}

public int main (string[] args) {
    return new Thelma().run (args);
}
The non Builder version did this with:var window = new Gtk.ApplicationWindow (this);
Regards,
Al

   


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