I am using the following code for a GUI in perl. In the case of buttons two clicks are needed for the action. how can i clear this??? Thanks in advance... My code is:

#!/usr/bin/perl -w use strict; use warnings; use Win32::GUI qw(CW_USEDEFAULT); use Win32::GUI::BitmapInline(); use Win32::Process; use Win32; my $ss; my $DOS = Win32::GUI::GetPerlWindow(); Win32::GUI::Hide($DOS); my $mw = Win32::GUI::Window->new( -title => "Test", -left => CW_USEDEFAULT, -size => [500,500], -color => 0x80FFFF, ); $mw->Animate( -show => !$mw->IsVisible(), -activate => 1, -animation => 'center', #-direction => $d, -time => 500, ); $mw->AddButton( -text => "Start", -left => $mw->Width() - 480, -top => $mw->Height() - 480, -size => [75,30], -onClick => \&fun2, ); $mw->AddButton( -text => "End", -left => $mw->Width() - 400, -top => $mw->Height() - 480, -size => [75,30], -onClick => \&fun12, ); $mw->AddButton( -text => "Process", -left => $mw->Width() - 320, -top => $mw->Height() - 480, -size => [75,30], -onClick => \&fun1, ); $mw->AddButton( -text => "Printer List", -left => $mw->Width() - 240, -top => $mw->Height() - 480, -size => [75,30], -onClick => \&funp, ); $mw->Show(); Win32::GUI::Dialog(); $mw->Hide(); undef $mw; exit(0); our ($pid,$user,$proc,$dn,$str); sub fun1() { $ss=""; for my $line (`tasklist /v /nh`) { chomp($line); if ( $line ne "" ) { # extract PID my $pid = substr($line, 26, 6); # remove leading spaces $pid =~ s/^ *([0-9]+)$/$1/g; # extract username my $user = substr($line, 88, 50); # remove trailing spaces $user =~ s/^(.*\S)\s+$/$1/g; # change spaces in username to underscores $user =~ s/\s/\_/g; # extract process my $proc = substr($line, 0, 24).substr($line, 152, 72); # change multiple spaces to single spaces $proc =~ s/\s\s\s*/ /g; # remove trailing space $proc =~ s/\s$//g; # remove trailing N/A $proc =~ s/ N\/A$//g; # print tab seperated fields print $pid, "->", $user, "->", $proc, "\n"; $ss=$ss."$pid->$user->$proc\r\n"; if($proc =~ /perl.exe C:\\Perl\\bin\\perl.exe/) { print "YEEEEEEEEEEEEEEEEEEEE"; `taskkill /PID $pid`; } } } $pid = 111; $mw->AddTextfield( -name => 'time', -text => $ss, #-prompt => [ "Test Text Field:", 80 ], -pos => [20,100], -size => [300,300], -align => 'left', -multiple => 1, -number => 0, -multiline => 1, -hscroll => 1, -vscroll => 1, -autohscroll => 1, -autovscroll => 1, ); #print "Current process' parent PID is " . getppid(); } sub fun2() { system("invoice_snail.pl"); } sub funp() { $str=""; my @pp=`cscript prnjobs.vbs -l`; foreach my $pp (@pp) { if($pp =~ /Document/) { $dn=$pp; $dn=~ s/Document //; $dn=~ s/.*[\/\\](.*)/$1/; $str=$str.$dn."\t"; } if($pp =~ /Job status/) { $str=$str.$pp."\r\n"; } } $mw->AddTextfield( -name => 'time', -text => $str, #-prompt => [ "Test Text Field:", 80 ], -pos => [20,100], -size => [300,300], -align => 'left', -multiple => 1, -number => 0, -multiline => 1, -hscroll => 1, -vscroll => 1, -autohscroll => 1, -autovscroll => 1, ); }

In reply to Perl GUI by jomonantony

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.