Re: ListStore + glade



On Fri, 2010-04-09 at 01:43 +0400, Alexey Savartsov wrote:
> Glib::RefPtr<Gtk::ListStore> m_refListStore;
> 
> ...
> 
> Glib::RefPtr<Glib::Object> objListStore = get_object("liststore");
> assert(objListStore);
> m_refListStore =
> Glib::RefPtr<Gtk::ListStore>::cast_dynamic(objListStore);
> 
> Isn't something like this a way to acess liststores and other
> non-widget objects? As for me, this code is working for treeview w/
> liststore created in glade3, using [] operator and
> Gtk::TreeModel::ColumnRecord derived class oblect or using
> get/set_value.

I think you've been lucky. In Glade you are telling it about C types,
such as int, gchararray, but in gtkmm code you are dealing with C++
types. If those C++ types are similar then it might just work. For
instance, there may be an automatic conversion to
std::string/Glib::ustring. But even then I would not be very confident
about it.

It's hard for me to recommend this because it's likely to fail in weird
ways when using some C++ types.

-- 
murrayc murrayc com
www.murrayc.com
www.openismus.com



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