Re: adding widget to vbox created by glade
- From: Gezim Hoxha <gezimetc shaw ca>
- To: Robert Pearce <rob bdt-home demon co uk>
- Cc: gtkmm-list gnome org
- Subject: Re: adding widget to vbox created by glade
- Date: Sun, 02 Dec 2007 11:58:40 -0700
On Sun, 2007-12-02 at 12:38 +0000, Robert Pearce wrote:
> On Sun, 2 Dec 2007, Gezim Hoxha <gezimetc shaw ca> wrote :
> >
> >So, now this code works:
> > Gtk::VolumeButton *my1223 = new Gtk::VolumeButton;
> > myvbox->pack_end(*my1223);
> > my1223->show();
> >
> >but this doesn't:
> > Gtk::VolumeButton my1223;
> > myvbox->pack_end(my1223);
> > my1223.show();
> >
> >and my question is, why doesn't this last code work?
> >
> Is this code in a function / method? Because if so the explanation is
> simple. The second form creates a _local_ _temporary_ Gtk::VolumeButton
> object and packs then shows it. And then the function / method
> terminates and all local objects are destroyed, including the widget.
>
> The first form makes the widget on the heap and only destroys a pointer
> to it.
Thanks Robert, that makes sense. Still trying to wrap my head around the
GUI programming paradigm.
-Gezim
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]