Using inherited window with GtkBuilder

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

 



Hello!

I'm trying to use my custom GtkWindow class (call it MyWindow) with
GtkBuilder, but I'm not sure how to do that.

I want to get an object of class MyWindow from the GtkBuilder object.
So, I tried to set the "class" attribute to "MyWindow" in my XML file
and cast to MyWindow when I use the get_object method from GtkBuilder.

This example code (in Vala, witch is the programming language used for
my application) throw an exception with the message "Invalid object type
`MyWindow'".

try{
    var builder = new Builder();
    builder.add_from_file("mygui.ui");
    var window = builder.get_object("mainwindow") as MyWindow;
    window.start();

    Gtk.main();
} catch(Error e){
    stderr.printf(e.message);
}

Am I losing something?

Thanks in advance!
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list


[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux