Re: Do widgets have to be members of class?
- From: Daniel Elstner <daniel kitta googlemail com>
- To: Krzesimir Nowak <qdlacz gmail com>
- Cc: hokie54 <nick5449 yahoo com>, gtkmm-list gnome org
- Subject: Re: Do widgets have to be members of class?
- Date: Tue, 15 Sep 2009 14:38:27 +0200
Am Dienstag, den 15.09.2009, 14:24 +0200 schrieb Krzesimir Nowak:
> Your label in constructor has local scope, so after constructor finishes
> its activity, label is destroyed. So yes, it has to be a member of your
> class. Or have global scope, which is ugly.
Eeek, no. Just use Gtk::manage() and container ownership:
Gtk::Label *const label = new Gtk::Label("LABEL");
table.attach(*Gtk::manage(label), 0, 1, 0, 1);
Personally, I use Gtk::manage() for widgets more often than not. I do
not make widgets member of a class if the code does not need to access
it after construction.
--Daniel
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]