Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

windows system tray 'pop ups'

by schweini (Friar)
on May 27, 2005 at 19:33 UTC ( #461203=perlquestion: print w/replies, xml ) Need Help??

schweini has asked for the wisdom of the Perl Monks concerning the following question:

Oh thee enlighted ones,

does anyone know how I can make a little program show up as 'sytem tray' icon under windows (seems easy enough even for a Win32::GUI novice as me, according to the how-to), let it monitor a serial port (I have that part figured out, too), and show one of those "you have X new mails" pop-ups/slide-outs that e.g. Thunderbird uses when some certain text is received from the serial port? Is there some perl/Tk way to do this? I just learned that Activestate's Perl Dev Kit includes something called 'PerlTray', but I somehow doubt that it supports these 'slide-outs'.
any help greatly appreciated,


Update: fixed some typos

Replies are listed 'Best First'.
Re: windows system tray 'pop ups'
by scmason (Monk) on May 27, 2005 at 21:08 UTC
    If I were doing this, I would use a microsoft development kit make an app to sit in the tray and monitor. When conditions were right, call on your perl TK app to create the 'tray' slideout/popup.

    Simply create a main window the size and position and define the activities you want it to have. To make it look like a 'popup/slideout' (drawn without window border/controls) call overrideredirect(0) on your window. Like so:


    Good luck

    "Never take yourself too seriously, because everyone knows that fat birds dont fly" -FLC
Re: windows system tray 'pop ups'
by salva (Canon) on May 28, 2005 at 16:28 UTC
    wxWidgets (formerly wxWindows) supports tray icons on windows, I don't know if this functionality has already been wrapped on wxPerl, but it shouldn't be too difficult to do anyway
Re: windows system tray 'pop ups'
by zentara (Archbishop) on May 28, 2005 at 12:00 UTC
    Hi, I don't use windows and didn't write this, but here is a snippet posted recently, it may give you a head start.
    #!/usr/bin/perl use warnings; use strict; #The function name is defined as "Win32::GUI::NotifyIcon". #You will need to be carefull about the order of your sub... #Here a sample script to let's you see, just choose a nice win32 ico a +nd #name it god.ico in the same dir from where you will launch this scrip +t: #--------------- BEGIN{ use Win32::Console; Win32::Console::Free(); } use Win32::GUI; use Tk; $mw = MainWindow -> new; $mw -> wm('geometry', '0x0+0+0'); $mw->overrideredirect(1); &do_win32_stuff; MainLoop; #-------------------------------- sub do_win32_stuff{ $mw_win32 = new Win32::GUI::DialogBox( -width => 0, -height => 0, -name => 'MainWindow'); $icon = new Win32::GUI::Icon('god.ico'); new Win32::GUI::NotifyIcon( $mw_win32, -name => "Notify", -id => 1, -icon => $icon, -tip => "I\'am in the Systray!"); $call = Win32::GUI::Dialog(); $mw_win32->Notify->Delete(-id => 1); sub Notify_Click{ &my_menu; } } #-------------------------------- sub my_menu{ $popup = $mw->Menu(Name => 'popupMenu', -tearoff => 0); $popup->command(-label => 'Number 1',-command => [\&do_label,1] ); $popup->command(-label => 'Number 2',-command => [\&do_label,2]); $popup->separator; $popup->command(-label => 'Number 3', -command => [\&do_label,3]); $popup->command(-label => 'Number 4', -command => [\&do_label,4]); $popup->command(-label => 'Number 5', -command => [\&do_label,5]); $popup->separator; $popup->command(-label => 'Quit', -command => [ \&stop]); $popup->Popup(-popover => 'cursor', -popanchor => 'nw'); } #-------------------------------- sub stop{ exit; } #-------------------------------- sub do_label{ if(Exists($top)){ $label-> configure(-text => "I\'am $_[0]"); } else { $top = $mw ->Toplevel; $top->title(" Numbers"); $top->focus; $label = $top->Label (-text => "I\'am $_[0]", -relief => 'groove', -width => '24')->pack; } }

    I'm not really a human, but I play one on earth. flash japh
Re: windows system tray 'pop ups'
by holli (Abbot) on May 28, 2005 at 14:38 UTC
    A commercial solution :( but this is made trivial by using PerlTray from ActiveState's Perl Development Kit.

    holli, /regexed monk/
      the last time I used PerlTray, it had a bug that caused apps to crash if the user open the menu when the tray app was waiting for some IO.

      I reported the bug two years ago and it is still in "unconfirmed" state!

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://461203]
Approved by Steve_p
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (2)
As of 2022-01-27 03:19 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (70 votes). Check out past polls.