Re: Casting Glib::RefPtr



On Sat, 2008-10-25 at 17:17 +0200, Germán Diago wrote:
>         Glib::RefPtr<Gtk::Builder> b =
> Gtk::Builder::create_from_file("prueba.ui");
> 
>         Gtk::Window * w;
>         Gtk::TreeView * view;
>         Glib::RefPtr<Glib::Object> liststore;
> 
>         b->get_widget("window1", w);
>         //Glib::RefPtr<Glib::Object>::cast_static<Gtk::ListStore>(b->get_object("liststore"));
> 
>         Glib::RefPtr<Glib::Object> o = b->get_object("liststore");
>         
>         //This line is the one that does not compile
>         Glib::RefPtr<Glib::Object>::cast_static<Gtk::ListStore>(o);
> 
> 
> I want to cast to a liststore an object in the last line, but I can't.
> Which is the correct way to do it?

Given that I have to do guesswork on the error message because you
didn't paste it, I think you inverted the parameter:

I think what you want is :

liststore = Glib::RefPtr<Glib::ListStore>::cast_static(o);



Hub



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