From: Foo Ji-H. <jhf...@ex...> - 2006-02-28 09:17:50
|
Hi all, Hope someone from this mailing list can confirm this: I tried to write a simple wxPerl application, that will open in PerlTray. Compiling and running wxPerl on PerlApp is fine, but I need the application to launch from the system tray. My development platform is Windows 2000 SP4 + Perl 5.8.7 + PDK 6.0.2 + wxPerl 0.26. Below is the working test code: use strict; use warnings; use PerlTray; use Wx; my $app = MyApp->new; $app->MainLoop; package MyApp; use Wx qw( wxDefaultPosition wxDefaultSize); use base 'Wx::App'; sub OnInit { my $frame = Wx::Frame->new ( undef, # parent window -1, # ID -1 means any 'test', # title [-1, -1], # default position [300, 400], # size ); ; $frame->Show(1); } 1; The error is: The instruction at "0x1b5785c" referenced memory at "0x01b5785c". The memory cannot be "read". Hope to get some affirmation on this. Thanks. |
From: Peter <lan...@fr...> - 2006-02-28 09:45:09
|
Hi, No time to confirm. But perhaps in this case it would be better to use wxPerl's own tray class. It's demonstrated in Mark Dootsons tutorial in progress that he posted here recently: http://wxperl.gigi.co.uk/downloads/wxPerlTutorial.zip Regards, Peter On Tue, 28 Feb 2006 17:27:36 +0800, "Foo Ji-Haw" <jhf...@ex...> said: > Hi all, > > Hope someone from this mailing list can confirm this: > > I tried to write a simple wxPerl application, that will open in > PerlTray. Compiling and running wxPerl on PerlApp is fine, but I need > the application to launch from the system tray. My development platform > is Windows 2000 SP4 + Perl 5.8.7 + PDK 6.0.2 + wxPerl 0.26. > > Below is the working test code: > > use strict; > use warnings; > use PerlTray; > use Wx; > > my $app = MyApp->new; > $app->MainLoop; > > > package MyApp; > use Wx qw( > wxDefaultPosition wxDefaultSize); > use base 'Wx::App'; > > sub OnInit > { > my $frame = Wx::Frame->new ( undef, # parent > window > -1, # ID -1 means any > 'test', # title > [-1, -1], # default position > [300, 400], # size > ); > ; > $frame->Show(1); > } > > 1; > > The error is: > The instruction at "0x1b5785c" referenced memory at "0x01b5785c". The > memory cannot be "read". > > Hope to get some affirmation on this. > > Thanks. > > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting > language > that extends applications into web and mobile media. Attend the live > webcast > and join the prime developer group breaking into this new coding > territory! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 > _______________________________________________ > wxperl-users mailing list > wxp...@li... > https://lists.sourceforge.net/lists/listinfo/wxperl-users |
From: Foo Ji-H. <jhf...@ex...> - 2006-02-28 10:16:21
|
> But perhaps in this case it would be better to use wxPerl's own tray > class. > It's demonstrated in Mark Dootsons tutorial in progress that he posted > here recently: > > http://wxperl.gigi.co.uk/downloads/wxPerlTutorial.zip Thanks for the link. Will check it out. |
From: Foo Ji-H. <jhf...@ex...> - 2006-02-28 10:23:17
|
Thanks Peter, Wx::TaskBarIcon seems to be what I'm looking for. If I want to capture a hotkey from the desktop, what is the best way to do it? Where should I register the accelerator? Peter wrote: > Hi, > > No time to confirm. > But perhaps in this case it would be better to use wxPerl's own tray > class. > It's demonstrated in Mark Dootsons tutorial in progress that he posted > here recently: > > http://wxperl.gigi.co.uk/downloads/wxPerlTutorial.zip > > Regards, > Peter > > On Tue, 28 Feb 2006 17:27:36 +0800, "Foo Ji-Haw" > <jhf...@ex...> said: > >> Hi all, >> >> Hope someone from this mailing list can confirm this: >> >> I tried to write a simple wxPerl application, that will open in >> PerlTray. Compiling and running wxPerl on PerlApp is fine, but I need >> the application to launch from the system tray. My development platform >> is Windows 2000 SP4 + Perl 5.8.7 + PDK 6.0.2 + wxPerl 0.26. >> >> Below is the working test code: >> >> use strict; >> use warnings; >> use PerlTray; >> use Wx; >> >> my $app = MyApp->new; >> $app->MainLoop; >> >> >> package MyApp; >> use Wx qw( >> wxDefaultPosition wxDefaultSize); >> use base 'Wx::App'; >> >> sub OnInit >> { >> my $frame = Wx::Frame->new ( undef, # parent >> window >> -1, # ID -1 means any >> 'test', # title >> [-1, -1], # default position >> [300, 400], # size >> ); >> ; >> $frame->Show(1); >> } >> >> 1; >> >> The error is: >> The instruction at "0x1b5785c" referenced memory at "0x01b5785c". The >> memory cannot be "read". >> >> Hope to get some affirmation on this. >> >> Thanks. >> >> >> >> ------------------------------------------------------- >> This SF.Net email is sponsored by xPML, a groundbreaking scripting >> language >> that extends applications into web and mobile media. Attend the live >> webcast >> and join the prime developer group breaking into this new coding >> territory! >> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 >> _______________________________________________ >> wxperl-users mailing list >> wxp...@li... >> https://lists.sourceforge.net/lists/listinfo/wxperl-users >> > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting language > that extends applications into web and mobile media. Attend the live webcast > and join the prime developer group breaking into this new coding territory! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 > _______________________________________________ > wxperl-users mailing list > wxp...@li... > https://lists.sourceforge.net/lists/listinfo/wxperl-users > |
From: Foo Ji-H. <jhf...@ex...> - 2006-03-01 08:26:30
Attachments:
minitray.pl
|
Hi all, Can someone enlighten me on the a/m; using Wx::TaskBarIcon? I tried to use the Destroy() method, but while it works on the W2K platform (and is very unstable), it does not for the W2K3 platforn. My guess is that is NOT the way to do it. Attached is my working code. Thanks. |
From: Mark D. <mar...@zn...> - 2006-03-01 09:17:50
|
I find using Wx::PlTreadEvent to raise TaskBar events solves the kind of problems you have been seeing. I also generally structure my applications somewhat differently from your example code. Think "My application will hide and display a taskbar icon" rather than "My taskbar icon will launch my application" Regards Mark Foo Ji-Haw wrote: > Hi all, > > Can someone enlighten me on the a/m; using Wx::TaskBarIcon? > > I tried to use the Destroy() method, but while it works on the W2K > platform (and is very unstable), it does not for the W2K3 platforn. My > guess is that is NOT the way to do it. > > Attached is my working code. > > Thanks. > > > ------------------------------------------------------------------------ > > use strict; > use warnings; > > $|=1; > > my $app = MyApp->new; > $app->MainLoop; > > package MyApp; > use strict; > use warnings; > use Wx qw( :everything ); > use base 'Wx::App'; > > sub OnInit > { > my $this = shift; > > my $tray = TrayWin->new; > $tray->SetIcon( > Wx::Icon->new('logo.ico',wxBITMAP_TYPE_ICO), > 'Tooltip'); > } > > package TrayWin; > use strict; > use warnings; > use Wx qw( :everything ); > use Wx::Menu; > use Wx::Event qw(EVT_MENU EVT_TASKBAR_LEFT_DOWN EVT_TASKBAR_RIGHT_DOWN); > use base qw(Wx::TaskBarIcon); > > my ($ID_SYSTRAY_EXIT); > > sub new { > my $class = shift; > > my $self = $class->SUPER::new( @_ ); > bless $self,$class; > > ($ID_SYSTRAY_EXIT) = (12000..12100); > > # create event handlers > EVT_MENU($self,$ID_SYSTRAY_EXIT,\&onClose); > > EVT_TASKBAR_RIGHT_DOWN($self,\&onPopup ); > > return $self; > } > > sub onPopup { > my ($self, $event) = @_; > > my $menu = Wx::Menu->new(); > $menu->Append($ID_SYSTRAY_EXIT, 'Exit' ); > $self->PopupMenu( $menu ); > } > > sub onClose > { > my $self = shift; > > $self->RemoveIcon; > $self->Destroy; > } > > # ==================================================================== > # remove the following package to get a stable program > # ==================================================================== > package MyDialog; > use strict; > use warnings; > use Wx qw( :everything ); > use base qw(Wx::Dialog); > > sub new > { > my $class = shift; > my $parent = shift; > > my $self = $class->SUPER::new( > undef, # parent window > -1, # ID -1 means any > 'Title here', # title > wxDefaultPosition, # default position > wxDefaultSize, # size > ); > } > > 1; |
From: Foo Ji-H. <jhf...@ex...> - 2006-03-01 10:33:38
|
Hello Mark, I have examined your published codes (example_6, thanks), and I think I understand your approach. May I know where you got the documentation for PlThreadEvent? I can't find it even on the wxWindows documentation. It seems to me that the system tray runs on its own thread. Is that why you created a shared event object? Mark Dootson wrote: > I find using Wx::PlTreadEvent to raise TaskBar events solves the kind of > problems you have been seeing. > > I also generally structure my applications somewhat differently from > your example code. > > Think "My application will hide and display a taskbar icon" rather than > "My taskbar icon will launch my application" > > Regards > > Mark > > > Foo Ji-Haw wrote: > >> Hi all, >> >> Can someone enlighten me on the a/m; using Wx::TaskBarIcon? >> >> I tried to use the Destroy() method, but while it works on the W2K >> platform (and is very unstable), it does not for the W2K3 platforn. My >> guess is that is NOT the way to do it. >> >> Attached is my working code. >> >> Thanks. >> >> >> ------------------------------------------------------------------------ >> >> use strict; >> use warnings; >> >> $|=1; >> >> my $app = MyApp->new; >> $app->MainLoop; >> >> package MyApp; >> use strict; >> use warnings; >> use Wx qw( :everything ); >> use base 'Wx::App'; >> >> sub OnInit >> { >> my $this = shift; >> >> my $tray = TrayWin->new; >> $tray->SetIcon( >> Wx::Icon->new('logo.ico',wxBITMAP_TYPE_ICO), >> 'Tooltip'); >> } >> >> package TrayWin; >> use strict; >> use warnings; >> use Wx qw( :everything ); >> use Wx::Menu; >> use Wx::Event qw(EVT_MENU EVT_TASKBAR_LEFT_DOWN EVT_TASKBAR_RIGHT_DOWN); >> use base qw(Wx::TaskBarIcon); >> >> my ($ID_SYSTRAY_EXIT); >> >> sub new { >> my $class = shift; >> >> my $self = $class->SUPER::new( @_ ); >> bless $self,$class; >> >> ($ID_SYSTRAY_EXIT) = (12000..12100); >> >> # create event handlers >> EVT_MENU($self,$ID_SYSTRAY_EXIT,\&onClose); >> >> EVT_TASKBAR_RIGHT_DOWN($self,\&onPopup ); >> >> return $self; >> } >> >> sub onPopup { >> my ($self, $event) = @_; >> >> my $menu = Wx::Menu->new(); >> $menu->Append($ID_SYSTRAY_EXIT, 'Exit' ); >> $self->PopupMenu( $menu ); >> } >> >> sub onClose >> { >> my $self = shift; >> >> $self->RemoveIcon; >> $self->Destroy; >> } >> >> # ==================================================================== >> # remove the following package to get a stable program >> # ==================================================================== >> package MyDialog; >> use strict; >> use warnings; >> use Wx qw( :everything ); >> use base qw(Wx::Dialog); >> >> sub new >> { >> my $class = shift; >> my $parent = shift; >> >> my $self = $class->SUPER::new( >> undef, # parent window >> -1, # ID -1 means any >> 'Title here', # title >> wxDefaultPosition, # default position >> wxDefaultSize, # size >> ); >> } >> >> 1; >> > > > |
From: Mark D. <mar...@zn...> - 2006-03-02 01:13:09
|
Hi All, Have posted some replies to PDK list on using wxPerl with PerlTray. Came up with example at: http://www.gigi.co.uk/wxperl/pdk/ Thought it might be useful to post here too. As far as I can see, the main practical differences between PerlTray and TaskBarIcon would be: 1) PerlTray gives you 'Balloon' text and HotKeys without resort to Win32::API. 2) TaskBarIcon can be loaded / unloaded by your app, whilst PerlTray is the primary 'thread' in any application built with it. Regards Mark |
From: Foo Ji-H. <jhf...@ex...> - 2006-03-02 03:00:06
|
Wow, that's amazing. Thanks for the community-centric effort Mark. Appreciate it. Mark Dootson wrote: > Hi All, > > Have posted some replies to PDK list on using wxPerl with PerlTray. > Came up with example at: > > http://www.gigi.co.uk/wxperl/pdk/ > > Thought it might be useful to post here too. > > As far as I can see, the main practical differences between PerlTray and > TaskBarIcon would be: > > 1) PerlTray gives you 'Balloon' text and HotKeys without resort to > Win32::API. > 2) TaskBarIcon can be loaded / unloaded by your app, whilst PerlTray is > the primary 'thread' in any application built with it. > > Regards > > Mark > > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting language > that extends applications into web and mobile media. Attend the live webcast > and join the prime developer group breaking into this new coding territory! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 > _______________________________________________ > wxperl-users mailing list > wxp...@li... > https://lists.sourceforge.net/lists/listinfo/wxperl-users > |
From: Foo Ji-H. <jhf...@ex...> - 2006-03-02 04:59:44
Attachments:
PerlTrayApp.pl
|
As a follow-up to Mark's contribution, I have come up with (what I think is) a leaner sample framework for using wxPerl with PerlTray. Thanks to all who have contributed on this issue. |
From: Ed W <li...@wi...> - 2006-03-28 17:16:45
|
Foo Ji-Haw wrote: > As a follow-up to Mark's contribution, I have come up with (what I > think is) a leaner sample framework for using wxPerl with PerlTray. > I used something similar to this for my application framework and then had problems with the app not shutting down when the user logs out. From checking the code I think you will have the same issues? How did you work around this? Cheers Ed W |
From: Mark D. <mar...@zn...> - 2006-03-28 18:15:40
|
Ed, You're right. One fix is to respond to EVT_END_SESSION in Wx::App, and cause main application window to close. Amended code at: http://www.gigi.co.uk/wxperl/pdk/perltrayexample.txt does now close down properly when session ends. (App class is at end of example) Regards Mark Ed W wrote: ............. > > I used something similar to this for my application framework and then > had problems with the app not shutting down when the user logs out. > From checking the code I think you will have the same issues? How did > you work around this? > > Cheers > > Ed W |