Re: Adding widgets to a vector class/Unknown amount of widgets in a window



Christian,

The rule of thumb here is that all widgets in gtkmm are non-copyable and non-assignable.
I hope you understand the rationale of this.  (For example, why would you want to duplicate
an X-element?  Or why would you want to have more than one widget refer to the same
underlying resource and, by doing so, create a race condition of some sort?)

Your 'buttons.push_back(btn);' line attempts to assign one button object to the other and
fails.  The obvious advice I can give is to allocate widgets on the heap and use the container
to store pointers to them.



Regards,

Nickolai Dobrynin


PS   Another rule of thumb is that people tend to use their full name when posting to this list.



On 3/3/06, krampenschiesser freenet de <krampenschiesser freenet de > wrote:
Hi,
I want to create a window with an unknown amount of buttons and scales.
Therefore I created a vector<Gtk::Button> buttons;
The Button I wanted to add was:
Gtk::Button btn("hello");
but compiling
buttons.push_back(btn);
failed because something with the constructor and = was private.
Do you have any idea how I could solve this problem?
thx Christian

--
Everything should be made as simple as possible, but not simpler.
                -- Albert Einstein
_______________________________________________
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]