|
From: Daniel C. C. <cri...@gm...> - 2007-02-06 15:00:14
|
Hi,
=20
Do you work under linux ?
=20
If yes then you must do this before you call Destroy
=20
$myParentFrame->Show(0);
=20
I hope it helps. If not I will try to run your code when I get home.
=20
_____ =20
From: wxp...@li...
[mailto:wxp...@li...] On Behalf Of Daniel
Sent: Tuesday, February 06, 2007 4:33 PM
To: wxp...@li...
Subject: [wxperl-users] How to quit an Wx application? - Another Idea
=20
Hi,
as far as I see, it is not easy to exit an application from inside. I =
tried
to destroy everything before the exit, but in fact it don't work...
My (new) question: Isn't it possible to cause the same event as clicking =
on
the "X" in the top right border? Why do I have to programm it again, I =
think
it's still done.
I know your time is rare, but if anyone could help me.....
The actual code ist like that:
---- code start ----
#!/usr/bin/perl -w
#
use strict;
use Wx;
package MyFrame;
use base qw(Wx::Frame);
use Wx qw(wxDefaultPosition wxDefaultSize wxNO_FULL_REPAINT_ON_RESIZE
wxCLIP_CHILDREN);
use Wx::Event qw(EVT_BUTTON);
my $self;
sub new {
my $ref =3D shift;
$self =3D $ref->SUPER::new( undef,
-1,=20
'Exit-Test',
[50,50],
[300, 200]
);
$self->SetIcon( Wx::GetWxPerlIcon() );
=20
my $notebook =3D Wx::Notebook->new( $self,=20
-1,=20
wxDefaultPosition,=20
wxDefaultSize,
=20
wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN
);
my $panel_update =3D Wx::Panel->new( $notebook,
-1
);
$notebook->AddPage( $panel_update, "Exit", 0 );
$panel_update->{button}{"killme"} =3D Wx::Button->new( =
$panel_update,
-1,
'killme',
[75, 20],
[150, -1]
);
=20
EVT_BUTTON($panel_update, $panel_update->{button}{"Exit"}, sub {=20
#HERE THE APPLICATION SHOULD EXIT
$panel_update->Destroy();
$notebook->Destroy();
$self->Destroy();
MyWindow->Killme(); #does the $frame->Destroy();
exit(); #doesn't work
});
my $status =3D Wx::StatusBar->new( $self, -1 );
$status -> SetFieldsCount( 1 );
$status -> SetStatusText( "Program running!" );
$self->SetStatusBar($status);=20
return $self;
}
package MyWindow;
use base qw(Wx::App);
my $frame;
sub OnInit {
$frame =3D MyFrame->new;
$frame->Show( 1 );
}
sub Killme {
$frame->Destroy();=20
}
package main;
my $wxobj =3D MyWindow->new();
$wxobj->MainLoop;
---- code end ----
Thanks,=20
Daniel
----- Urspr=FCngliche Mail ----
Von: Daniel <dan...@ya...>
An: Daniell Freed <win...@gm...>
CC: wxp...@li...
Gesendet: Dienstag, den 6. Februar 2007, 09:39:55 Uhr
Betreff: Re: [wxperl-users] How to quit an Wx application?
Hi Daniell,
thanks for your answer. I think I know what you mean but in fact I don't
know how to do this. I made a sample script. It's like my application =
but
very small. So if you have time could you please be so kind and make it
working? I think (or hope) it's easy for you.
---- begin code ----
#!/usr/bin/perl -w
#
use strict;
use Wx;
package MyFrame;
use base qw(Wx::Frame);
use Wx qw (wxDefaultPosition wxDefaultSize wxNO_FULL_REPAINT_ON_RESIZE
wxCLIP_CHILDREN);
use Wx::Event qw(EVT_BUTTON);
my $self;
sub new {
my $ref =3D shift;
$self =3D $ref->SUPER::new( undef,
-1,=20
'Exit-Test',
[50,50],
[300, 200]
);
$self->SetIcon( Wx::GetWxPerlIcon() );
=20
my $notebook =3D Wx::Notebook->new( $self,=20
-1,=20
wxDefaultPosition,=20
wxDefaultSize,
=20
wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN
);
my $panel_update =3D Wx::Panel->new( $notebook,
-1,
);
$notebook->AddPage( $panel_update, "Exit", 0 );
$panel_update->{button}{"install"} =3D Wx::Button->new( =
$panel_update,
-1,
'kill me',
[75, 20],
[150, -1],
);
=20
EVT_BUTTON($panel_update, $panel_update->{button}{"Exit"}, sub {=20
#HERE THE APPLICATION SHOULD EXIT
#$self->Destroy();
#$frame->Destroy(); doesn't know $frame here
#exit(); #doesn't work
});
my $status =3D Wx::StatusBar->new( $self, -1 );
$status -> SetFieldsCount( 1 );
$status -> SetStatusText( "Program running!" );
$self->SetStatusBar($status);=20
return $self;
}
package MyWindow;
use base qw(Wx::App);
sub OnInit {
my $frame =3D MyFrame->new;
$frame->Show( 1 );
}
package main;
my $wxobj =3D MyWindow->new();
$wxobj->MainLoop;
---- end code ----
Thanks!=20
Daniel
----- Urspr=FCngliche Mail ----
Von: Daniell Freed <win...@gm...>
An: Daniel <dan...@ya...>
CC: wxp...@li...
Gesendet: Montag, den 5. Februar 2007, 23:48:26 Uhr
Betreff: Re: [wxperl-users] How to quit an Wx application?
You need to destroy any windows you have. Closing them doesn't actually
destroy them from memory.
=20
Once you are done with the window do: $frame->Destroy();
=20
Then you can exit(); =20
=20
Thanks,
Dan Freed
=20
=20
=20
On Feb 5, 2007, at 4:23 PM, Daniel wrote:
Hi all,
=20
I know, it sounds stupid but I don't know how to quit my application =
from
inside.
=20
I used the following code:
=20
package MyWindow; =20
use base qw(Wx::App); =20
=20
sub OnInit {
my $frame =3D MyFrame->new;
$frame->Show( 1 );
}
=20
package main;
my $wxobj =3D MyWindow->new(); =20
$wxobj->MainLoop;
=20
In package MyWindow there is in function new defined:
=20
$self =3D $ref->SUPER::new( undef, # parent window
-1, # Window id
"$title", # Titel
[50,50], # Position x/y
[950, 600] # Size x/y
);
=20
So if I just do an exit() nothing happens but showing the waiting mouse
pointer. Same if I use
$self->Close(1);
=20
Can someone help me please?
=20
=20
Thanks
Daniel
=20
=20
=20
=20
=20
___________________________________________________________=20
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de
=20
-------------------------------------------------------------------------=
Using Tomcat but need to do more? Need to support web services, =
security?
Get stuff done quickly with pre-integrated technology to make your job
easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache =
Geronimo
http://sel.as-us.falkag.net/sel?cmd=3Dlnk
<http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D=
121642>
&kid=3D120709&bid=3D263057&dat=3D121642
_______________________________________________
wxperl-users mailing list
wxp...@li...
https://lists.sourceforge.net/lists/listinfo/wxperl-users
=20
Daniell Freed
win...@gm...
Bereshit bara Elohim et hashamayim ve'et ha'arets...
=20
=20
=20
_____ =20
Der neue Internet Explorer 7 in deutscher Ausf=FChrung ist da
<http://de.rd.yahoo.com/evt=3D44263/*http:/de.downloads.yahoo.com/interne=
texpl
orer/index.php> !
-------------------------------------------------------------------------=
Using Tomcat but need to do more? Need to support web services, =
security?
Get stuff done quickly with pre-integrated technology to make your job
easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache =
Geronimo
http://sel.as-us.falkag.net/sel?cmd=3Dlnk
<http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D=
121642>
&kid=3D120709&bid=3D263057&dat=3D121642
_______________________________________________
wxperl-users mailing list
wxp...@li...
https://lists.sourceforge.net/lists/listinfo/wxperl-users
=20
=20
_____ =20
Was ist Gl=FCck? Schlafen Fische =FCberhaupt? Die Antworten gibt=92s auf =
Yahoo!
<http://de.rd.yahoo.com/xx/searchpromo/i/tagline/cleverfp/*http:/de.answe=
rs.
yahoo.com> Clever.
|