Re: help on array of widgets
- From: Yann Leydier <yann leydier info>
- To: gtkmm-list gnome org
- Subject: Re: help on array of widgets
- Date: Wed, 27 Jul 2011 13:30:48 +0200
It is the exact opposite ! :o)
std::vector<Gtk::Button*> buttons;
buttons.push_back(Gtk::manage(new Gtk::Button("but")));
vbox.pack_start(*buttons.back(), …
Calling Gtk::manage(widget_pointer) will cause the widget to be freed
when its parent is destroyed.
Glib::RefPtr is generally not to be used when the API does not force you
to use it.
Yann
On 27/07/11 13:21, Mj Mendoza IV wrote:
> 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
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]