Re: Using inherited window with GtkBuilder




This will work in C,


Two questions:
  - what C symbol does vala generate 
    for your get_type() stub
  - what does vala's implementation
    of GtkBuilder->get_type_from_name()
   do ?

Answering those questions should
get you there

Cheers,
   -Tristan

On 2012-01-14, at 12:49 PM, Damián Nohales <damiannohales gmail com> wrote:

> 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 gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list


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