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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WAIT position

Status
Not open for further replies.

tilltek

Programmer
Mar 8, 2001
298
PH
This has been asked several times in the past but never answered so here it is again...
How do I position a WAIT message relevant to the VFP window as opposed to relevant to the Windows Desktop.

Aussie Ken
"Far, Far Away"
CAMIGUIN ISLAND
 
Hi Aussie,

You can use the WINDOW AT NROW, NCOL clause of the wait command to position the resulting window relative to your screen. The following code will allow you to ajust it relative to your VFP screen:

Code:
lcMyMessage = "Hello World"
lnOldScaleMode = _SCREEN.ScaleMode
_SCREEN.ScaleMode = 0   && USE FOXELS
WAIT WINDOW lcMyMessage ;
WINDOW AT _SCREEN.TOP + 10, _SCREEN.LEFT + 20 NOWAIT
_SCREEN.ScaleMode = 3  && Use Pixels

If you plan to use this a lot, write a class or a function that encapsulate this logic and that accepts your message as a parameter.

Jean
 
Hi again Jean.
If I cut, paste and run your snippet, I get " Command contains unrecognized etc etc" on the WAIT line.
This has been suggested before and it simply does not do the job.
Try it yourself.
wait "My message" window at 2,2
puts "My message" in the top left corner of the Wimdows Desktop, even if the VFP screen is made very small and moved to the bottom right of the Windows Desktop.
In other words, position 2,2 relative to the Windows Desktop.
I want it to be relative to the VFP window.

Aussie Ken
"Far, Far Away"
CAMIGUIN ISLAND
 

Ken,

The reason for the error is that Jean's code contains a small syntax error. In the WAIT line, the word WINDOW appears twice. If you remove the first occurrence, it will work.

Jean's code will produce the result you want. If you simply say WAIT xxx AT 2,2, the co-ordinates will be relative to the physical screen. But by using _SCREEN.TOP and _SCREEN.LEFT, as in Jean's code, the window will be located relative to the VFP window.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Ah ha!!!! that seems to have solved the problem (worth a FAQ?).
Ken Fergusson (son of Fergus)
"Far, Far Away"
CAMIGUIN ISLAND
(nee Aberdeen)
 
Hello all,

to center the wait window I use the following:

x= SCOLS()
y =SROWS()
LOCAL pos1,pos2,teksts
pos1 = y/2
pos2 = x/2
teksts = "Wait please!!!"
lt = LEN(teksts)/2
wait (teksts) window at pos1,pos2-lt nowait

regards, Paul
 

Paul,

Your code successfully centres the wait window, but I don't think it meets Ken's original requirement, as the centring is relative to the physical screen, not to the VFP window.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Thanks for all the input guys and gals. Problem solved.
Camiguin is just a little warmer than Aberdeen but also very isolated when it comes to fellow computer users.
Local programmers work for just $us5.00 a day but produce only one days (spaghetti) code each month.

Aussie Ken
"Far, Far Away"
CAMIGUIN ISLAND
 

Mike,

Paul's code does center WAIT WINDOW relative to the VFP screen, not physical screen.
SROWS() and SCOLS() function return number of rows/columns of the main VFP window.
And it works like it should, too, in my tests (conducted in VFP6).
 

Stella,

Paul's code does center WAIT WINDOW relative to the VFP screen, not physical screen.

Hmm. That wasn't my experience last time I tested this, but I'm willing to admit I might have got it wrong. I'll take another look when I get some time.


Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top