Thanks for the suggestion. I tried it and it works...sort of.

First off, it is painfully slow. Takes a couple of minutes for
a small file (2K) to display, one line at a time. This can't be
normal for Perl on Windows can it? 

Second, no scroll box, even tho the -multiline and -autovscroll
parameters are set to 1.

Third, the GUI app disappears completely after the last line is
printed. How do you keep the window (and/or DOS command window)
up and displayed?

Isn't there a better way to flow text into a scroll-bar field or
window or dialog or something?

-Kevin


  use strict;
  use Win32::GUI;

  my $main = Win32::GUI::Window->new(
    -name    => "Main",
    -title   => "Win32-GUI: Doevents-Demo",
    -left    => 100,
    -top     => 100,
    -width   => 600,
    -height  => 800,
  );

  sub Main_Terminate() {
    print "Main window terminated\n";
    return -1;
  }

  my $textfield = $main->AddTextfield(
    -name   => "Textfield",
    -text   => "have fun and more",
    -left   => 75,
    -top    => 150,
    -width  => 200,
    -height => 600,
    -readonly => 1,
    -multiline   => 1,
    -autovscroll => 1
  );

  $main->Show();

  my $output;  # possibly declare this globally further up...
  my $infile="/Documents and Settings/Kevin/Desktop/Stuff/Perl/samplegui2.pl";
  $output.="Processing infile $infile...";
  $textfield->Text($output);
  open INFILE, "<$infile" or die "open infile error: $! File: $infile";
  foreach my $line (<INFILE>) {
    chop $line;
    $output.="$line\r\n";
    #$textfield->Text($output);
    #print "$line\n";
   
   Win32::GUI::DoEvents() >= 0 or die "Window was closed during processing";
   sleep 1;     #body of the loop...
  }
   
  $output.="completed";
  $textfield->Text($output);
  Win32::GUI::DoEvents();
  sleep 1;      #program continues...


Reply via email to