|
From: Daniel <dan...@ya...> - 2007-02-06 14:33:27
|
Hi,=0A=0Aas 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.=
..=0A=0AMy (new) question: Isn't it possible to cause the same event as cli=
cking on the "X" in the top right border? Why do I have to programm it agai=
n, I think it's still done.=0A=0AI know your time is rare, but if anyone co=
uld help me.....=0A=0AThe actual code ist like that:=0A=0A---- code start -=
---=0A=0A#!/usr/bin/perl -w=0A#=0A=0Ause strict;=0Ause Wx;=0A=0Apackage MyF=
rame;=0Ause base qw(Wx::Frame);=0A=0Ause Wx qw(wxDefaultPosition wxDefaultS=
ize wxNO_FULL_REPAINT_ON_RESIZE wxCLIP_CHILDREN);=0A=0Ause Wx::Event qw(EVT=
_BUTTON);=0A=0Amy $self;=0A=0Asub new {=0A my $ref =3D shift;=0A=0A $=
self =3D $ref->SUPER::new( undef,=0A -1, =0A=
'Exit-Test',=0A =
[50,50],=0A [300, 200]=0A =
);=0A=0A $self->SetIcon( Wx::GetWxPerlIcon() );=0A =
=0A my $notebook =3D Wx::Notebook->new( $self, =0A =
-1, =0A wxD=
efaultPosition, =0A wxDefaultSize,=0A =
wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN=0A=
);=0A=0A my $panel_update =3D Wx::Pane=
l->new( $notebook,=0A -1=0A =
);=0A=0A $notebook->AddPage( $panel_update, "Exit", 0 );=
=0A=0A=0A $panel_update->{button}{"killme"} =3D Wx::Button->new( $panel_=
update,=0A -1,=0A =
'killme',=0A [75, 20],=0A =
[150, -1]=0A =
);=0A =0A EVT_BUTTON($panel_update, $panel_update->{button}{"Exi=
t"}, sub { =0A=0A #HERE THE APPLICATION SHOULD EXIT=0A $panel_upd=
ate->Destroy();=0A $notebook->Destroy();=0A $self->Destroy();=0A =
MyWindow->Killme(); #does the $frame->Destroy();=0A exit(); #doe=
sn't work=0A });=0A=0A my $status =3D Wx::StatusBar->new( $self, -1 )=
;=0A $status -> SetFieldsCount( 1 );=0A $status -> SetStatusText( "Pr=
ogram running!" );=0A $self->SetStatusBar($status); =0A=0A return $se=
lf;=0A}=0A=0Apackage MyWindow;=0Ause base qw(Wx::App);=0A=0Amy $frame;=0A=
=0Asub OnInit {=0A $frame =3D MyFrame->new;=0A $frame->Show( 1 );=0A}=0A=
=0Asub Killme {=0A $frame->Destroy(); =0A}=0A=0Apackage main;=0Amy $wxobj =
=3D MyWindow->new();=0A$wxobj->MainLoop;=0A=0A---- code end ----=0A=0AThank=
s, =0ADaniel=0A=0A=0A=0A=0A=0A=0A----- Urspr=FCngliche Mail ----=0AVon: Dan=
iel <dan...@ya...>=0AAn: Daniell Freed <win...@gm...>=0ACC: =
wxp...@li...=0AGesendet: Dienstag, den 6. Februar 200=
7, 09:39:55 Uhr=0ABetreff: Re: [wxperl-users] How to quit an Wx application=
?=0A=0AHi Daniell,=0A=0Athanks for your answer. I think I know what you mea=
n but in fact I don't know how to do this. I made a sample script. It's lik=
e 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.=0A=0A---- b=
egin code ----=0A=0A#!/usr/bin/perl -w=0A#=0A=0Ause strict;=0Ause Wx;=0A=0A=
package MyFrame;=0A=0A=0Ause base qw(Wx::Frame);=0A=0Ause Wx qw (wxDefaultP=
osition wxDefaultSize wxNO_FULL_REPAINT_ON_RESIZE wxCLIP_CHILDREN);=0A=0A=
=0Ause Wx::Event qw(EVT_BUTTON);=0A=0Amy $self;=0A=0A=0Asub new {=0A my =
$ref =3D shift;=0A=0A $self =3D $ref->SUPER::new(=0A undef,=0A =
-1, =0A 'Exit-Test',=
=0A [50,50],=0A =
[300, 200]=0A =0A );=0A=0A $self->SetIcon( =
Wx::GetWxPerlIcon() );=0A =0A my $notebook =
=3D Wx::Notebook->new( $self, =0A -1, =0A =
wxDefaultPosition, =0A =
=0A wxDefaultSize,=0A wxNO_FU=
LL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN=0A );=
=0A=0A my $panel_update =3D Wx::Panel->new( $notebook,=0A =
-1,=0A );=0A=0A $noteboo=
k->AddPage(=0A $panel_update, "Exit", 0 );=0A=0A=0A $panel_update->{butt=
on}{"install"} =3D Wx::Button->new( $panel_update,=0A =
-1,=0A 'kill me',=0A =
[75,=0A 20],=0A =
[150, -1],=0A );=0A =0A EVT_BU=
TTON($panel_update, $panel_update->{button}{"Exit"}, sub { =0A=0A #HER=
E THE APPLICATION SHOULD EXIT=0A #$self->Destroy();=0A #$frame->D=
estroy(); doesn't know $frame here=0A #exit(); #doesn't work=0A })=
;=0A=0A my $status =3D Wx::StatusBar->new( $self, -1 );=0A $status ->=
SetFieldsCount( 1=0A );=0A $status -> SetStatusText( "Program running!"=
);=0A $self->SetStatusBar($status); =0A=0A return $self;=0A}=0A=0Apa=
ckage MyWindow;=0Ause base qw(Wx::App);=0A=0Asub OnInit {=0A my $frame =3D=
MyFrame->new;=0A $frame->Show( 1 );=0A}=0A=0Apackage main;=0Amy $wxobj =
=3D MyWindow->new();=0A$wxobj->MainLoop;=0A=0A---- end code ----=0A=0A=0A=
=0AThanks! =0ADaniel=0A=0A=0A=0A=0A----- Urspr=FCngliche Mail ----=0AVon: D=
aniell Freed <win...@gm...>=0AAn: Daniel <dan...@ya...>=0ACC=
: wxp...@li...=0AGesendet: Montag, den 5. Februar 200=
7, 23:48:26 Uhr=0ABetreff: Re: [wxperl-users] How to quit an Wx application=
?=0A=0AYou need to destroy any windows you have. Closing them doesn't actu=
ally destroy them from memory.=0A=0AOnce you are done with the window do: =
$frame->Destroy();=0A=0A=0AThen you can exit(); =0A=0A=0AThanks,=0ADan Fre=
ed=0A=0A=0A=0A=0A=0AOn Feb 5, 2007, at 4:23 PM, Daniel wrote:=0A=0AHi all,=
=0A=0A=0AI know, it sounds stupid but I don't know how to quit my applicati=
on from inside.=0A=0A=0AI used the following code:=0A=0A=0Apackage MyWindow=
; =0A =0Ause base qw(Wx::App); =
=0A=0A=0Asub OnInit {=0A my $frame =3D MyFrame->new;=0A $frame->Show( =
1 );=0A}=0A=0A=0Apackage main;=0Amy $wxobj =3D MyWindow->new(); =
=0A$wxobj->MainLoop;=0A=0A=0AIn=0A package MyWindow there is in function ne=
w defined:=0A=0A=0A $self =3D $ref->SUPER::new( undef, # parent w=
indow=0A -1, # Window id=0A =
"$title", # Titel=0A =
=0A [50,50], # Position x/y=0A [950,=
600] # Size x/y=0A );=0A=0A=0ASo if I just =
do an exit() nothing happens but showing the waiting mouse pointer. Same if=
I use=0A$self->Close(1);=0A=0A=0ACan someone help me please?=0A=0A=0A=0A=
=0AThanks=0ADaniel=0A=0A=0A=0A=0A=0A=0A=0A=0A=09=09=0A=0A__________________=
_________________________________________ =0ATelefonate ohne weitere Kosten=
vom PC zum PC: http://messenger.yahoo.de=0A=0A=0A-------------------------=
------------------------------------------------=0AUsing Tomcat but need to=
do more? Need to support web services, security?=0AGet stuff done quickly =
with pre-integrated technology to make your job easier.=0ADownload IBM WebS=
phere Application Server v.1.0.1 based on Apache Geronimo=0Ahttp://sel.as-u=
s.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D121642=0A_______=
________________________________________=0Awxperl-users mailing list=0Awxpe=
rl-...@li...=0Ahttps://lists.sourceforge.net/lists/listin=
fo/wxperl-users=0A =0A=0A Daniell Fre...@gm...=0ABereshit ba=
ra Elohim et hashamayim ve'et ha'arets...=0A=0A=0A =0A=0A=0A=0A=0A=0A=0A=0A=
=0A=09=09Der neue Internet Explorer 7 in deutscher Ausf=FChrung ist da=0A!-=
------------------------------------------------------------------------=0A=
Using Tomcat but need to do more? Need to support web services, security?=
=0AGet stuff done quickly with pre-integrated technology to make your job e=
asier.=0ADownload IBM WebSphere Application Server v.1.0.1 based on Apache =
Geronimo=0Ahttp://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263=
057&dat=3D121642=0A_______________________________________________=0Awxperl=
-users mailing lis...@li...=0Ahttps://lists.so=
urceforge.net/lists/listinfo/wxperl-users=0A=0A=0A=0A=0A=0A=0A=0A=09=09=0A_=
__________________________________________________________ =0ATelefonate oh=
ne weitere Kosten vom PC zum PC: http://messenger.yahoo.de |