Adam W. Klaum wrote:
> [...]
> The only thing I'm having a problem with is when I click the
> button to start or stop the service I end up using a while
> loop for the tail. The execution of the tail while loop locks
> the window object in place and you can't minimize or move
> the window or click anything while the tail is running.
> I mentioned something like this earlier in the list but had
> no code to show at the time.

you can use $Window->DoEvents() inside the loop to process
pending events. it will probably not be instantly responsive,
but better than nothing :-)

> Someone replied stating that I could use the Timer function
> to divorce the tail process from the window operations.
> I have looked at the Timer documentation and can't seem to
> figure out how it would help in this situation.  Any insight
> or alternate suggestions would be great.

basically, you go like this: in the Daemon(Start|Stop)_Click
events setup a Timer object like this:

    if(defined $Timer) {
        $Timer->SetInterval( 1000 );
    } else {
        $Timer = $Window->AddTimer( "Working", 1000 );
    }
    
the 1000s stand for 1 second interval, you can change this
to your like (is in milliseconds).

then write a Working_Timer sub that does what you do in the
loop (without the loop of course, it gets already called once
per second by the Timer itself). when you reach your final
condition, put this to disable the timer:

    $Timer->Kill();
    
of course, you should add extra code here and there to
Disable buttons while the Timer it's running and re-enable
them when it has finished.

I hope this makes some sense ;-)

> I have included the code but the services are
> proprietary so you all won't get to see it actually working
> :-(.  You should be able to run it and see the layout though
> (and the pretty start and stop buttons I made).  The whole
> tail mess begins at the DaemonStart_Click subroutine.

way cool buttons :-)


cheers,
Aldo

__END__
$_=q,just perl,,s, , another ,,s,$, hacker,,print;



Reply via email to