[EMAIL PROTECTED] wrote:
> Hi all
>        I just finished a GUI based utility written in
> Perl/TK. I use this utility to install applications on servers.
> The problem I have is that when an app is being installed, I
> have a dialog box which is a top level widget with a ROText
> and a progress bar at the bottom.
> ISSUE: When my applications are being installed, any window
> that pops over the dialog box has leaves its image on the box
> until the install is over and the box refreshes with $T->update()
> 
> Is there a way to keep my window updated while my script
> waits for system("Install.exe") to finish.

I am not aware of any modules that can help with this in general, but
you might be able to do it if you execute your system command in a
separate thread. Although Tk is known not to be thread safe, it should
be O.K. if all of your Tk code is executed in the same thread. For
example, the following untested code might help. It should make sure
that the update function gets called every second.

# These are needed
use strict;
use warnings;

# So are these
use threads;
use threads::shared;

sub exec_command_while_updating {
    my $T = shift;              # widget to update
    my $cmd = shift;            # command to exec

    my $var : shared;           # use for condition variable

    my $thr = async {
        system $cmd;
        lock $var;
        cond_signal $var;
    };
    $thr->detach;               # so we don't need to join

    lock $var;
    while (!cond_timedwait($var, time + 1)) {
        $T->update;
    }
}

Give that a try if nobody comes up with a better solution.

HTH

-- 
Brian Raven
 


-----------------------------------------------------------------------
The information contained in this e-mail is confidential and solely 
for the intended addressee(s). Unauthorised reproduction, disclosure, 
modification, and/or distribution of this email may be unlawful. If you 
have received this email in error, please notify the sender immediately 
and delete it from your system. The views expressed in this message 
do not necessarily reflect those of LIFFE Holdings Plc or any of its subsidiary 
companies.
-----------------------------------------------------------------------


_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to