Thread Task-Icon-Menu ohne Funktion? (8 answers)
Opened by xiconfjs at 2006-05-17 12:08

xiconfjs
 2006-05-17 12:08
#45460 #45460
User since
2006-01-21
79 Artikel
BenutzerIn
[Homepage] [default_avatar]
Hi,

ich habe eine Frage zu einen Skript aus eurem Wiki. Es ist das Skript, welches ein Tray-Icon erstellt und ein Menu per Rechtsklick erzeugt. Trotz 2 stündigen Versuchens bekomme ich es nicht hin, den Menupunkten funktionen zuzuordnen. Hat da einer vielleicht einen Tipp für mich? :P

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/perl
use Win32::GUI;
use strict;
use warnings;

my $id = 1;
my $hwnd = GUI::GetPerlWindow(); GUI::Hide($hwnd);
my $icon = new Win32::GUI::Icon('an.ico');
my $main = Win32::GUI::Window->new(
-name => 'Main',
-text => 'Perl',
-width => 200,
-height => 200,
);
my $ni = $main->AddNotifyIcon(
-name => "systray",
-id => $id,
-icon => $icon,
-tip => "Go Back!up",
);
Win32::GUI::Dialog();
Win32::GUI::Show($hwnd);



sub systray_RightClick {
my $systray_menu = new Win32::GUI::Menu(
"SystrayMenu Functions" => "SystrayMenu",
#"Go Back!up",
"> Info" => "Systray_info",
"> Dienst" =>"",
">> Starten" => "Systray_start",
">> Stoppen" => "Systray_stop",
">> Restart" => "Systray_restart",
">> Pausieren" => "Systray_pause",
"> Exit" => "SystrayExit",
);
my($x, $y) = Win32::GUI::GetCursorPos();
$main->TrackPopupMenu($systray_menu->{SystrayMenu}, $x, $y-50);
}

sub Main_Terminate {
Win32::GUI::NotifyIcon::Delete( $ni, -id => $id );
return -1;
}

sub systray_Terminate {
Win32::GUI::NotifyIcon::Delete( $ni, -id => $id );
return -1;
}

View full thread Task-Icon-Menu ohne Funktion?