PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Shawn Anderson on October 14, 2009, 07:37:57 PM

Title: redraw a listbox
Post by: Shawn Anderson on October 14, 2009, 07:37:57 PM
I have a simple form with a button and a list box.
When the button is pressed, it starts a process inserting items into a database.
I want each record to display in the list box like:
record 1 inserted
record 2 inserted
etc.
I assume I need a redraw.
Would you use dialog or control redraw?
I tried control redraw hWndForm HWND_FORM1_LIST1 but the dialog just went white and the whole thing was blinking.
Title: Re: redraw a listbox
Post by: Shawn Anderson on October 14, 2009, 07:40:55 PM
dialog redraw seems to work better, but that seems the opposite of what I'd use... redrawing the entire dialog instead of one control
Title: Re: redraw a listbox
Post by: TechSupport on October 14, 2009, 09:11:48 PM
More than likely your application is doing some data intensive task and it is not allowing the controls to repaint. You should realize that WM_PAINT is a pretty low priority message in Windows. Having said that, you can periodically send an FF_Control_Redraw function call to your listbox and it should work.

BTW, Control Redraw and Dialog Redraw are DDT commands and *may* work with FireFly created controls.... or may not. I'd stick with the FireFly Functions or use WinAPI directly:

InvalidateRect HWND_FORM_LIST1, ByVal %Null, %TRUE
UpdateWindow HWND_FORM_LIST1
Title: Re: redraw a listbox
Post by: Mark Strickland on October 15, 2009, 10:46:09 AM
What about FF_DoEvents?  I have good luck inserting that in compute intensive loops when I want some display updating to occur.

If you can handle some small delays try putting a SLEEP 100 (with more or less time depending) in your compute loop.  You can also condition this to only happen every few times through the loop:

IF LoopCounter MOD 10 = 0 THEN
  SLEEP 100
END IF


Some food for thought.