Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Force form to "paint" 2

Status
Not open for further replies.

SteveDingle

Programmer
Jul 26, 2004
254
GB
Heya All,

Hope ya'll are having/had a wonderful holiday.

I have created my own form to act like a WAIT WINDOW. but not using the WAIT WINDOW command at all. Everything works fine except if I create the form just before a long process. Like a SQL Select or making a call to a COM object and waiting for a response.

Basically I can see the Border and titlebar of the form but the "inside" where my text is being display remain transaparent (i.e. I can see the control on the form underneath)

In the activate and show I am seting the _VFP.AutoYield to true. Have tried calling DOEVENTS (FORCE).

Also have tried manually calling the REFRESH, PAINT and DRAW.

Any thoughts?

Toodles,
Steve Dingle
D&S Business Solutions Ltd
 
Hi Steve,

My first thought is that the form has got its Lockscreen set to .T. I think that might cause the behaviour you described.

Failing that ... well, there must be something unusual about the form. Obviously, this isn't normal behaviour.

Maybe you should start again with a plain form, and gradually add the required features until the behaviour comes back.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
I have the same issue on a Terminal Server (both VFP 7 and 9) when I put MS SQL Server queries that take 10-30 seconds to be prepared and returnd in any method that fires during or immediately after load/init methods. I have even tried using SLEEP to give the form a chance to draw.

I'm getting around it by saving the last set of results in the user's temp directory and loading them into the form's grid until the user presses the 'refresh' button.

In the meantime the form asks the server to prepare the query on init in anticipation of the refresh.

So you're not alone, but I have no solution but a workaround.

Brian
 
Thanks Guys,

Mike: not lockscreen and I have tried it with a basic form. The form am using works fine except when I have long tasks right after Show()ing it. I have seen the transparency before, usually only with Activex controls. Very frustrating

Brian: nice to know I'm not the only one, hadn't heard of the SLEEP before, shame it didn't work

tc and happy holidays
Steve
 
Steve,

Well, Lockscreen was only a guess. Pity that wasn't the solution.

But I'm not surprised that SLEEP doesn't solve it. The whole point about SLEEP is that your application doesn't process events during the sleeping period, so there would be no chance for the form to paint itself.

I wonder if a timer would work. In the form's Init, start the timer with an interval of, say, 1,000 ms. When that time has elapsed, go ahead with the long process.

Just a thought.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Steve, I have had similar problems when performing selects for reports. I like to display a Label with a caption of "Preparing Report" before executing the Select statement for the report. The label would not appear until I added the following command just after making the label visible and centering it on the form and just before the select statement. I can't say it works every time, but it does seem to help with this issue. You might try varying the timeout.

Wait Window '' Timeout(.001)

Auguy
 
INKEY(.01, "HM") in the Activate method (not Show) worked for me.

Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top