At 16:38 2002-08-26 -0500, Gossett, Malachy wrote:
Well, it still doesn't look like I'm getting it, but I am trying to get this to minimize to the sys tray. Anyone with experience in this see where I am missing the boat?

You never create a NotifyIcon, only an Icon.

The following is from a small script of mine (Clipboard Transformer, hence the names).


#Tray icon
my $fileIcon = "resource/transformer.ico";
my $icoTray = new Win32::GUI::Icon($fileIcon) or die("Could not load icon ($fileIcon)\n");

#This is what actually puts the icon in the tray
my $niTray = Win32::GUI::NotifyIcon->new($winTransformer,
        -name   => "niTray",
        -id     => 1,
        -icon   => $icoTray,
        -tip    => $textNameProgram,
        );

So in an event (either the window's Minimize event, or a buttons Click event, or whatever), you Hide() your window. Only the tray icon is left for the user to click on.


In the events for the NofifyIcon, you Show() the window (or display a popup menu or something):

sub ::niTray_Click {
    return(::niTray_RightClick(@_));
    }

sub ::niTray_RightClick {

    #Here you Show() your window again.

    return(1);
    }


/J

-------- ------ ---- --- -- --  --  -    -     -      -         -
Johan Lindström    Sourcerer @ Boss Casinos     [EMAIL PROTECTED]

Latest bookmark: "Taste for Makers"
http://www.paulgraham.com/taste.html
dmoz (1 of 7): /Computers/Programming/Languages/Lisp



Reply via email to