Re: help on array of widgets



> If you are looking for a way to store your widgets in memory, you cannot 
> put them directly in a vector, since vectors copy objects and widgets 
> instances cannot be copied. You can instead store pointers to your widgets.

I tried making a vector of RefPtr, but how do I instantiate a widget in a RefPtr and placing it on a VBox?

std::vector<Glib::RefPtr<Gtk::Button> > buttons;

Glib::RefPtr<Gtk::Button> foo = Gtk::Button::Button("RefPtr Button", false); // <--- does not work
buttons.push_back(foo);
m_VBox.pack_start(&buttons[0], Gtk::PACK_SHRINK); // <-- not sure how to do it :(

 
Regards.

Mj Mendoza IV,
Developer, KonsolScript
http://www.konsolscript.org



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