For Programmers: Free Programming Magazines  


Home > Archive > PerlTk > January 2005 > activate an Activity Bar from a program









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author activate an Activity Bar from a program
jiehuang001@hotmail.com

2005-01-12, 3:59 pm

In my perl program, it calls another host program that takes a long
time. And I want the user to see an activity bar while the program is
running. So, what i need is, when the host program runs, an activity
bar shows up. when it is done, then the activity bar disappears.

below is my pseudo code, but apparently it won't work. The activity bar
does not synchronize with the host program ...

Please help.

Jie Huang

=================
`run_a_host_program`;
$activity_bar = $the_frame->ActivityBar()->pack();
$activity_bar->startActivity();

zentara

2005-01-13, 4:00 pm

On 12 Jan 2005 09:47:45 -0800, jiehuang001@hotmail.com wrote:

>In my perl program, it calls another host program that takes a long
>time. And I want the user to see an activity bar while the program is
>running. So, what i need is, when the host program runs, an activity
>bar shows up. when it is done, then the activity bar disappears.
>
>below is my pseudo code, but apparently it won't work. The activity bar
>does not synchronize with the host program ...
>
>Please help.
>
>Jie Huang
>
>=================
>`run_a_host_program`;
>$activity_bar = $the_frame->ActivityBar()->pack();
>$activity_bar->startActivity();


You need to put alot more thought into what you are trying to do.

First, if you are running your external program thru backticks, or
system, your activity bar will stop working while the external command
runs....unless you do one of the following

1. run the external program in a separate thread and communicate thru
shared variables

2. call $mw->update frequently in your external program(if possible).

I posted some code awhile back on running a long download and
showing a progressbar. Search for "tk threaded downloader" on
groups.google.com for the code. It is big and I don't want to repost
it here.

If you want a quick way, look at the Tk::ExecuteCommand module. It
will give you a blinking button while the command executes.






--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com