in reply to Re^3: Win32::SysTray Issue ( Win32::GUI::DoEvents )
in thread Win32::SysTray Issue
Here is my dumbed down code as you can see I have a user input style menu and I would like to stop the program using the Icon in the system tray if possible. At the moment the program is blocked while waiting for user input. Is there a way to bypass that? Thanks again!
#!/usr/bin/perl -w use strict; use warnings; use diagnostics; use Term::ANSIScreen; use Win32::Console; use Win32::SysTray; no warnings 'numeric'; tray(); begin(); sub begin { # START BEGIN print "-------------------------------------------\n"; print "Please Choose One of the Following Options:\n"; print "-------------------------------------------\n\n\n"; print "(1) EMPLOYEE MANAGEMENT \n\n"; print "(Q) QUIT \n\n"; print " \n\n\n\n"; my $input = <STDIN>; $input = <STDIN> until defined $input; chop ($input); if ($input){ if ( $input == 1 ){ sleep(3); begin(); } if ( $input eq "q" ) { sleep 3; exit; } } # END INPUT } # END BEGIN sub tray { my $stray = new Win32::SysTray ( 'name' => 'TEST', 'icon' => 'C:\images\logo.ico', 'single' => 1, ) or exit 0; $stray->setMenu ( "> &Test" => sub { print "Hello from the Tray\n"; }, ">-" => 0, "> E&xit" => sub { exit; }, ); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Win32::SysTray Issue ( Win32::GUI::DoEvents )
by jcb (Parson) on Oct 21, 2020 at 01:23 UTC | |
by PilotinControl (Pilgrim) on Oct 21, 2020 at 02:15 UTC | |
by jcb (Parson) on Oct 21, 2020 at 21:08 UTC |