Why is this not working?
the tk stuff is from some website,
a working example i presume for it
does what the code shows.
i added the scan_files and the
update_list subroutine. it will
not work!
why not?
#!c:\perl\bin\perl.exe
use Tk;
use Win32::ChangeNotify;
$Sig_Path = "c:\\test";
# Create main window.
my $main = new MainWindow;
# A menu bar is really a Frame.
$menubar = $main->Frame(-relief=>"raised",
-borderwidth=>2);
# Menubuttons appear on the menu bar.
$filebutton = $menubar->Menubutton(-text=>"File",
-underline => 0); # F in File
# Menus are children of Menubuttons.
$filemenu = $filebutton->Menu();
# Associate Menubutton with Menu.
$filebutton->configure(-menu=>$filemenu);
# Create menu choices.
$filemenu->command(
-command => \&scan_dir,
-label => "Start...",
-underline => 0); # S in Scan
$filemenu->separator;
$filemenu->command(-label => "Exit",
-command => \&exit_choice,
-underline => 1); # "x" in Exit
# Help menu.
$helpbutton = $menubar->Menubutton(-text=>"Help",
-underline => 0); # H in Help
$helpmenu = $helpbutton->Menu();
$helpmenu->command(-command => \&about_choice,
-label => "About TkMenu...",
-underline => 0); # A in About
$helpbutton->configure(-menu=>$helpmenu);
# Pack most Menubuttons from the left.
$filebutton->pack(-side=>"left");
# Help menu should appear on the right.
$helpbutton->pack(-side=>"right");
$menubar->pack(-side=>"top", -fill=>"x");
# Create a label widget for the main area.
$label = $main->Label(-text => "Main Area");
# Set to expand, with padding.
$label->pack(-side=>"top", -expand=>1,
-padx=>100, -pady=>100);
# Create a status area.
$status = $main->Label(-text=>"Status area",
-relief=>sunken,
-borderwidth=>2,
-anchor=>"w");
$status->pack(-side=>"top", -fill=>"x");
# Let Perl/Tk handle window events.
MainLoop;
# Subroutine to handle button click.
sub exit_choice {
print "You chose the Exit choice!\n";
exit;
}
sub open_choice {
# Fill in status area.
$status->configure(-text=>"Open file.");
print "Open file\n";
}
sub about_choice {
# Fill in status area.
$status->configure(-text=>"About program.");
print "About tkmenu.pl\n";
}
sub scan_dir
{
undef my $changes;
$status->configure(-text=>"Scanning $Sig_Path...");
my $notify = Win32::ChangeNotify->new($Sig_Path,$WatchSubTree,$Events);
while (1) {
$notify->wait;
++$changes;
&update_list;
$notify->reset;
}
}
sub update_list
{
$status->configure(-text=>"Got one!!!!!!!!!...");
}
# tkmenu.pl
---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
[EMAIL PROTECTED]
For non-automated Mailing List support, send email to
[EMAIL PROTECTED]