Click to See Complete Forum and Search --> : wait message needs during graphic rendering


elimorris
07-13-2006, 02:41 AM
Dear All,

I have a page where I need to generate a png graphic on the fly before the page is complete. Currently I use the qx command to call a java program at the top of the perl script. qx returns after the png is rendered and the page can finish being created for the user.

To make this clearer, here is the web page:

http://hanalei.ucsc.edu/cgi-bin/hour_plot11.pl

The problem with this is that the png graphic needs about 10 seconds to render and during that time nothing is happening. I would like it if there was some sort of "Please wait while the plot is being drawn" kind of message while the plot is being rendered. I can't figure out how in the world to do such a thing. Can anyone think of anything?

thanks much,

eli

PineSolPirate
07-19-2006, 10:33 AM
I'm not sure if it would help, but you could try making a div, then hiding when the processing is done.
<div id="waitDiv" style="width: 200px; height: 100px; margin: auto;">Please Wait, Plot Rendering</div>
.
.The Render Code
.
<script type="text/javascript">
var waitDiv = document.getElementById('waitDiv');
waitDiv.style.width = "0px";
waitDiv.style.height = "0px";
waitDiv.style.visibility = "hidden";
waitDiv.style.position = "absolute";
waitDiv.style.top = "0px";
</script>
That ought to do it (maybe). You also prob. need to make the output handle hot, $| , I think. :)

elimorris
07-20-2006, 02:47 AM
Hi. Thanks for replying. I'm sorry, I don't understand what you mean here:

"You also prob. need to make the output handle hot, $| , I think."

thanks again,

eli

PineSolPirate
07-20-2006, 12:08 PM
Sorry, was going from memory. If you have problems with buffering in Perl, you can make a handle "hot" with "$| = 1;" Anyway, I figured since you were doing heavy processing in the background, you would want to get the "wait" message out of the buffer as soon as it hit the print statement. Check out http://perl.plover.com/FAQs/Buffering.html