Thank you,

I've found how to use Wx::MessageBox and Wx::MessageDialog without that perl
interpreter error.

Wx::MessageDialog also gives that error, unless I end with an exit();.

So I use:

my $dialog = Wx::MessageDialog->new($self, t("Are you sure you want to
close the application?"), t("Exit"), wxYES|wxNO, wxDefaultPosition);

if($dialog->ShowModal() == wxID_YES) {
   $self->Destroy();
   exit;
}

I guess this happends because my app uses threads and I don't know how to
end them even though sometimes I would like to kill them.

If I use $thread->kill(...) the program always ends with an error.

Octavian

----- Original Message ----- From: "bungsuputra linan" <[EMAIL PROTECTED]>
To: "wxperl-users" <[email protected]>
Sent: Friday, August 29, 2008 9:38 AM
Subject: Re: strange error


Hi Octavian Rasnita,

I usually use MessageDialog instead of MessageBox for similar case.

So, my suggestion is as follow:

my $dialog = Wx::MessageDialog->new($self, t("Are you sure you want to
close the application?"), t("Exit"), wxYES|wxNO, wxDefaultPosition);
if($dialog->ShowModal() == wxID_YES) {
  $self->Destroy();
}


On Tue, 2008-08-26 at 17:25 +0300, Octavian Rasnita wrote:
Hi,

I made an app with a menu that has an "Exit" item which if clicked, it is
handled by the following event handler:

sub OnExit {
my ($self, $event) = @_;

my $result = Wx::MessageBox(t("Are you sure you want to close the
application?"), t("Exit"), wxYES|wxNO);

if ($result == wxYES) {
$self->Destroy;
}
}

If I click the "no" button, all works fine, but if I choose yes to close
the
application, it appears a perl interpreter error window.

It is strange, because if I don't open that MessageBox, it doesn't appear
that error, although the same code is executed.
I've seen that even if I open a simple message box in the event handler
subroutine and I just print a message without checking for a return code,
it
still gives that error.

The following handler works fine:

sub OnExit {
my ($self, $event) = @_;
$self->Destroy;
}

Does it happen for you also or I need to re-install perl or WxPerl?

Thank you.

Octavian



Reply via email to