Hi,

I tried this way, but it doesn't change anything.
Here is the test program I wrote (the program is included in the message
because I don't know if the list supports attachments):

use strict;
use Wx qw(wxALIGN_RIGHT);
use Wx::Event qw(EVT_BUTTON EVT_CLOSE);

my $frame = Wx::Frame->new(undef, -1, "The app", [-1,-1], [200,150]);

my $panel = Wx::Panel->new($frame, -1);

Wx::StaticText->new($panel, -1, "&Fruit:", [20,20], [30,20], wxALIGN_RIGHT);

my $fruit = Wx::TextCtrl->new($panel, -1, "", [50,20], [100,20]);

my $add = Wx::Button->new($panel, -1, "&Add", [150,20], [50,20]);

$add->SetDefault;

Wx::StaticText->new($panel, -1, "F&ruits:", [20,60], [30,20],
wxALIGN_RIGHT);

my $list = Wx::ListBox->new($panel, -1, [50,60], [100,100]);

my $del = Wx::Button->new($panel, -1, "&Delete", [150,60], [50,20]);

EVT_BUTTON($frame, $add, \&add);
EVT_BUTTON($frame, $del, \&del);
EVT_CLOSE($frame, \&OnClose);

$frame->Show(1);
Wx::SimpleApp->new->MainLoop;

sub add {
my $current_fruit = $fruit->GetValue;

if (defined $current_fruit) {
$list->Append($current_fruit);
$fruit->Clear;
}
}

sub del {
my $index = $list->GetSelection;
$list->Delete($index) if $index >= 0;
}

sub OnClose {
my ($self, $event) = @_;
$self->Destroy();
Wx::wxTheApp->ExitMainLoop();
}

Octavian

----- Original Message ----- From: "Huub Peters" <[EMAIL PROTECTED]>
To: "Octavian Rasnita" <[EMAIL PROTECTED]>; "Mark Dootson"
<[EMAIL PROTECTED]>; <[email protected]>
Sent: Monday, November 19, 2007 1:01 PM
Subject: Re: temporary files


If I close the app using alt+F4, the app closes, but do I need to handle
that close event and close() or destroy() something in that close
handler?

I've mentioned this before in reply to a similar message.
This has helped me in the past (many, many versions ago) and I think it's
worth a try:

EVT_CLOSE($self, \&OnClose );

sub OnClose {
 my( $self, $event ) = @_;
 $self->Destroy();
 Wx::wxTheApp()->ExitMainLoop;
}

Please let us know if it makes any difference.

Cheers,
Huub Peters


Reply via email to