I am running the attached code on my win2k machine and I am seeing two
strange things.
1. When the window updates the Textfields flicker and the data in them
flicker. Is there anyway to get rid of that???
2. When I update the numbers in the Textfields I have noticed that windows
keeps a memory of their previous values. When the above flicker happens I
see the previous value for a brief micro second. It is most annoying. Is
there any way I can fix that.
In both cases I do want to keep the refresh time very low (less then 5
seconds).
Thanks,
Louis
use Win32::GUI;
use Net::FTP;
foreach (@ARGV)
{
$UserInfo[$i]=$_;
$i++;
}
&usage if $i<3;
###############################
# Variables
###############################
$FTPServer = $UserInfo[0];
$FTPUser = $UserInfo[1];;
$FTPPasswd = $UserInfo[2];;
$FTPUsersDir = "/tmp";
$FTPUsersTmpFile = "listevents.out";
$UsersFile = "c:\\temp\\listevents.out";
###############################
$W = new Win32::GUI::Window(
-title => "Win32::GUI::Louis Test",
-left => 100,
-top => 100,
-width => 225,
-height => 200,
-font => $F,
-name => "MainWindow",
);
$tX = 5;
$W->AddLabel(
-name => "Processed_Label",
-text => "Processed:",
-left => $tX,
-top => $tX,
);
$tYp = $W->Processed_Label->Height + 20 +$tX;
$W->AddLabel(
-name => "Queued_Label",
-text => "Queued:",
-left => $tX,
-top => $tYp,
);
$tYq = $W->Queued_Label->Height + 20 + $tYp;
$W->AddLabel(
-name => "Waiting_Label",
-text => "Waiting:",
-left => $tX,
-top => $tYq,
);
$tYw = $W->Waiting_Label->Height + 20 + $tYq;
$W->AddLabel(
-name => "ParsingFailed_Label",
-text => "ParsingFailed:",
-left => $tX,
-top => $tYw,
);
$tYpf = $W->ParsingFailed_Label->Height + 20 +$tYw;
$W->AddLabel(
-name => "Repository_Label",
-text => "Repository:",
-left => $tX,
-top => $tYpf,
);
$sb = $W->AddStatusBar(
-name => "Status",
-text => "Event Server Running ",
);
$tX_Processed += $W->Processed_Label->Width + 27;
$tX_Queued += $W->Queued_Label->Width + 39;
$tX_Waiting += $W->Waiting_Label->Width + 41;
$tX_ParsingFailed += $W->ParsingFailed_Label->Width + 14;
$tX_Repository += $W->Repository_Label->Width + 27;
############################################
############################################
# Process events to the window
############################################
############################################
$W->Show;
while (1)
{
$ftp=Net::FTP->new($FTPServer)|| die "FTP Users failed\n";
$ftp->login($FTPUser,$FTPPasswd)|| die "FTP login Users failed\n";
$ftp->cwd($FTPUsersDir) || die "FTP cd UsersFailed\n";
$ftp->get($FTPUsersTmpFile, $UsersFile)|| die "FTP get $FTPUsersTmpFile
Failed $!\n";
$ftp->quit;
open(File, "c:\\temp\\listevents.out")||die;
while(<File>)
{
@Data="";
chomp;
next if (! $_);
@Data=split(/-/,$_);
}
$W->AddTextfield(
-name => "Processed_Text",
-left => $tX_Processed,
-top => $tX,
-width => 80,
-height => 20,
-text => $Data[1],
);
$W->AddTextfield(
-name => "Queued_Text",
-left => $tX_Queued,
-top => $tYp,
-width => 80,
-height => 20,
-text => $Data[2]
);
$W->AddTextfield(
-name => "Waiting_Text",
-left => $tX_Waiting,
-top => $tYq,
-width => 80,
-height => 20,
-text => $Data[0],
);
$W->AddTextfield(
-name => "ParsingFailed_Text",
-left => $tX_ParsingFailed,
-top => $tYw,
-width => 80,
-height => 20,
-text => $Data[3],
);
$W->AddTextfield(
-name => "Repository_Text",
-left => $tX_Repository,
-top => $tYpf,
-width => 80,
-height => 20,
-text => $Data[4],
);
$sb->Text("EventSvr $Data[5] $Data[6]");
Win32::GUI::PeekMessage(0,0,0);
Win32::GUI::DoEvents() < 0;
exit(0) if !$W->IsEnabled();
sleep(1);
}
############################################
############################################
# Subrouteens to run
############################################
############################################
sub MainWindow_Terminate {-1;print "";}
sub usage
{
}
--
¤¤º°`°º¤ø,¸¸,ø¤º°`°º¤øø¤º°`°º¤ø,¸¸,ø¤º°`°º¤øø¤º°`°º¤
¤°`°Lightbridge, Inc
¤°`°67 South Bedford St.
¤°`°Burlington MA 01832
¤°`°781.359.4795 mailto:[EMAIL PROTECTED]
¤°`°http://www.lightbridge.com
¤¤º°`°º¤ø,¸¸,ø¤º°`°º¤øø¤º°`°º¤ø,¸¸,ø¤º°`°º¤øø¤º°`°º¤