|
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 |
|
From: Eriam S. <er...@er...> - 2007-02-06 15:13:15
|
>
> $panel_update->{button}{"killme"} =3D Wx::Button->new( $panel_updat=
e,
> -1,
> 'killme',
> [75, 20],
> [150, -1]
> );
>
> EVT_BUTTON($panel_update, $panel_update->{button}{"Exit"}, sub {
>
Hello Daniel,
Your event is attached to the wrong button $panel_update->{button}{"Exit"=
}
you should attach it to the correct button instead.
Bye
Eriam
|
|
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.
|