RE: Troubles with containers



I think the problem is that you create your widgets locally in the constructor. So they get destroyed after the constructor is called(end of scope).

You should make them as private or protected variables of your class(in your class implementaion).

> Date: Sun, 31 May 2009 14:13:37 +0200
> Subject: Troubles with containers
> From: micorulez gmail com
> To: gtkmm-list gnome org
>
> Hi,
> I'm trying to build a small dialog for an othello / reversi game using
> gtkmm, here is the constructor of my Gtk::Dialog :
>
>
> NewGameDialog::NewGameDialog()
> {
> Gtk::Entry entry;
> Gtk::Label label("Name");
> Gtk::VBox vbox_a;
> vbox_a.pack_start(label, Gtk::PACK_SHRINK);
> vbox_a.pack_start(entry, Gtk::PACK_SHRINK);
>
> Gtk::RadioButton radiobtn_a("Human");
> Gtk::RadioButtonGroup group = radiobtn_a.get_group();
> Gtk::RadioButton radiobtn_b(group, "Bot (CPU)");
> Gtk::VBox vbox_b;
> vbox_b.pack_start(radiobtn_a, Gtk::PACK_SHRINK);
> vbox_b.pack_start(radiobtn_b, Gtk::PACK_SHRINK);
>
> Gtk::ComboBoxText combobox;
> combobox.append_text("Bot::Stupid");
> combobox.append_text("Bot::Normal");
> combobox.append_text("Bot::God");
> Gtk::HBox hbox_a;
> hbox_a.pack_start(vbox_b, Gtk::PACK_EXPAND_PADDING);
> hbox_a.pack_start(combobox, Gtk::PACK_EXPAND_PADDING);
>
> Gtk::VBox vbox_c;
> vbox_c.pack_start(vbox_a, Gtk::PACK_EXPAND_PADDING);
> vbox_c.pack_start(hbox_a, Gtk::PACK_EXPAND_PADDING);
>
> get_vbox()->add(vbox_c);
> set_default_size(268, 128);
> show_all();
> }
>
> currently the dialog is showing up with its correct size, but there's
> nothing in it.
> Can anyone help me with this ?
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list


Δείξτε το στιλ σας με μια εικόνα στο Messenger. Δείτε τις όλες. Κάντε κλικ εδώ!


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