I don't have a running Wx available, but it sounds similar to a basic fine point in Gtk2. Since it's likely that your Wx build is based on the Gtk2 libs, I will mention it. You may have some confusion between the signal handlers between the "destroy" and "delete_event". An explanation by muppet is below.
> my $window => Gtk2::Window -> new; > $window -> signal_connect ( 'delete_event', sub { Gtk2 -> main_quit; + } ); Connect this to 'destroy' instead of 'delete-event'. The handler for 'delete-event' is supposed to return a boolean value saying "i handled + this" or "i didn't handle this", that is typically used to inhibit destructi +on of the window. You're not doing that, though. The default action from 'delete-event' is to destroy the window, which will cause the 'destroy +' event to fire. Of course, you can also get 'destroy' from other places in y +our program. So, if you connect the quit of the main loop to the main win +dow's 'destroy' rather than 'delete-event', you get a more robust program.
and here is a Gtk2 example which demonstrates the difference between delete and destroy. The delete_event is what is connected to the window manager's Close button. It sounds like you may need to intercept one of those signals in Wx.
#!/usr/bin/perl use warnings; use strict; use Gtk2 -init; my $window = Gtk2::Window->new; $window->add( Gtk2::Label->new("I'm a banana!") ); $window->show_all; $window->signal_connect( delete_event => sub { return !ask( $_[0], "Really quit?" ); } ); $window->signal_connect( destroy => sub { Gtk2->main_quit } ); Gtk2->main; sub ask { my ( $parent, $question ) = @_; my $msgbox = Gtk2::MessageDialog->new( $parent, [], 'question', 'yes-no', $qu +estion ); my $response = $msgbox->run(); $msgbox->destroy; return $response eq 'yes'; }

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

In reply to Re: wxPreviewFrame error on closing by zentara
in thread wxPreviewFrame error on closing by Steve_BZ

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.