NetTalk Central

Author Topic: How to create a progress/cover window (the easy way)  (Read 13990 times)

ccordes

  • Sr. Member
  • ****
  • Posts: 384
    • View Profile
    • Email
How to create a progress/cover window (the easy way)
« on: September 27, 2007, 08:22:38 AM »
Hi,
This is a continuation sort of ...

The second way I found to do this is a bit easier. In this situation the problem is that each record on the browse results in an embedded table of results from a child process. Each table takes a few seconds or so to create, but if the browse has 10 records there is still the chance that while the browser may not timeout, the user may get antsy and start clicking on the show report button several times. We don't want that.

On the NetWebBrowse Add 2 HTML routines - ShowWait and CloseWait
ShowWait - Routine, No Condition, Location:Before <form>
Code---------------------
<iframe id="waitframe" src="Pleasewait.htm" style="border: 2 solid #0000CC; height: 5em; width: 25em; position: relative"></iframe>
-------------------------
You could use a class for the style elements like ImportCover in the long version. The way it is here, displays the iframe whereever it happens to show up. That can be ugly, so you might want to use absolute positioning and put it right where you want.

Embed code at Bottom of Routine.ShowWait
Code---------------
   do sendpacket
-------------------

CloseWait - Routine, No Condition, Location:After </form>
Code --------------
<script type="text/javascript">
document.getElementById("waitframe").style.display="none";
</script>
-------------------

Done! - Pretty much. . .

This keeps the user occupied so they don't go off while the browse is loading. If you still need to keep the browser from running off, you need to put a call to PUSHPACK(p_web,sometext) in your process or browse. -This example code will send a non-displayable x to the browser every 5 seconds or so.
Code-------------------
!remember to set bt=clock() somewhere before your process loop
    if (clock() - bt) > 500
        bt=clock()
        pushpack(p_web,'<span class="NoShow">x</span>')
    end
--------------------

The CSS selector NoShow looks like this-
.NoShow {
  visibility: hidden;
  height: 1em;
  width: 1em;
  position: absolute;
  top: 0px;
  left: 0px
}

========================================
PUSHPACK - this sends a packet to the browser outside the usual webhandler for the current process.
PushPack             PROCEDURE  (NetWebServerWorker p_web, string p_packet)packetlen   long
! End of "Data Section"
  CODE
! Start of "Processed Code"
! [Priority 4000]
  packetlen = len(clip(p_packet))
  if packetlen > 0
    p_web.ParseHTML(p_packet, 1, packetlen, NET:NoHeader)
    p_packet = ''
    packetlen = 0
  end

=======================================

HTH,
Chris C.
Real programmers use copy con newapp.exe