Re: Does a widget exist?



On Friday, September 12, 2003, at 01:16 PM, Eric Depagne wrote:

As this test can be exectuted as many time as the user wants, I would like that if one frame already exist ( created by a prvious positive test) it is
destroyed before a new one is created.

instead of making $frame a lexical which is valid only inside the block, declare it outside the block.

        our $frame;
        ...
        if (...) {
                $frame->destroy if defined $frame;
                $frame = Gtk2::Frame->new (...);
                ...
        }

but really, if you are wanting to replace an existing plot with a new one every time through, you probably want to keep the frame around and merely replace its contents.

--
muppet <scott at asofyet dot org>




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