News: SPECIAL OFFER: EZGUI Classic (4.0) until May 31, 2013 only $29 !

TO REGISTER on Forum, contact tech support: http://cwsof.com/support.html
 
Pages: [1]   Go Down
  Print  
Author Topic: Delay Problem  (Read 141 times)
Brian Reynolds
PreRelease 4.5
Sr. Member
*
Posts: 304


View Profile
« on: July 30, 2012, 02:45:35 AM »

I wish to Display a Label while I am updating a Listview containing file data.
I have the following Label code:
Code:
   EZ_Label %FORM1_LABEL4, 34, 12, 24, 3.9375, "Main Music List|is being updated", "FC"
When I press the "Update" button, I use the following code:
Code:
         EZ_SetDepth "Form1", 140, "F"
         EZ_Sleep 2
the data updating then follows and when it has finished, I use:
Code:
         EZ_SetText "Form1", 140, "Main Music List|has been updated"
         EZ_Delay 2
         EZ_SetDepth "Form1", 140, "B"
Unfortunately, when I click the "Update" button, all I get of the label is the border, no background colour or text.
When the update has finished I get the "Main Music List|has been updated" correctly displayed.
Is there any way I can display something to let the operator know the list is being updated without them having to take any action when it is finished?
I tried a Message Box but nothing happens until the operator hits "Okay", then there is a wait while the update takes place.
Can someone offer advice?


Logged
Chris Boss
Administrator
Hero Member
*****
Posts: 1812


View Profile
« Reply #1 on: July 30, 2012, 08:33:24 AM »

In the code that updates the listview you could periodically change some control (ire. progressbar, label text, etc.) to indicate the current status of the update task. The problem is that until the code in the update routine finishes and returns control back to EZGUI, the controls won't be repainted.

To get around this you can use the EZ_RedrawControl command to force a control to repaint. So you could send text to a label and the call RedrawControl to force it to repaint immediated.

The EZ_DoEvents command also can be used which simply allows EZGUI to process any pending window messages (ie. WM_PAINT) before continuing on in the update code.

I should also point out that the SLEEP command (either PB's or EZGUI's version) is useless in an EZGUI app most of the time. It is only useful when you have some secondary threads running or if a task runs so long that the OS appears to freeze for other apps and you need to give some more time for other apps. In many cases though SLEEP is used when it is not needed or won't make any difference. SLEEP can also mess up the OS timing when switching between processes, if not used correctly and the results may not be what you expect.
Logged
Pages: [1]   Go Up
  Print  
 
Jump to: