Re: displaying an image
- From: Robert Pearce <rob bdt-home demon co uk>
- To: gtkmm-list gnome org
- Subject: Re: displaying an image
- Date: Thu, 23 Dec 2010 22:16:53 +0000
Hi Harry,
On Thu, 23 Dec 2010 18:39:16 +0000 you wrote:
>
> Bear in mind I have no experience with ::Inage, but ask why the pointer?
> Gtk::Image iconImage("Positive-48.png"); // this should work too I think
That depends entirely on the context. If you were to write, say:
MyWindow::make_display(void)
{
Gtk::Image iconImage("Positive-48.png");
vertical_box->pack_start ( iconImage, Gtk::PACK_SHRINK, 0);
}
then it would absolutely NOT work. The image thus created is a
temporary object allocated on the stack frame of the make_display
method, and ceases to exist as soon as that method completes. As this
will ALWAYS be before the image is actually drawn (since that happens
in the Gtk::mainloop iteration) the result will be no image on the
screen.
Cheers,
Rob
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]