Using inherited window with GtkBuilder
- From: Damián Nohales <damiannohales gmail com>
- To: gtk-list gnome org
- Subject: Using inherited window with GtkBuilder
- Date: Sat, 14 Jan 2012 00:49:42 -0300
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!
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]