Formula to Center WAIT WINDOW
Author Message
Formula to Center WAIT WINDOW

Is there an easy formula to use that centers the WAIT WINDOW command?

WAIT WINDOW AT 20, ?? lcMessage

Thanks,
John Gundrum

Sat, 22 Feb 2003 22:38:37 GMT
Formula to Center WAIT WINDOW
Something along the lines of this?

local m.lnOldScaleMode
m.lnOldScaleMode = _screen.scalemode
_screen.scalemode = 0 &&Foxels
Wait wind "Hello" at (_Screen.height/2),(_screen.width/2)
_screen.scalemode = m.lnOldScaleMode

HTH
jeremy

Quote:
> Is there an easy formula to use that centers the WAIT WINDOW command?

> WAIT WINDOW AT 20, ?? lcMessage

> Thanks,
> John Gundrum

Sat, 22 Feb 2003 23:00:22 GMT
Formula to Center WAIT WINDOW
That won't center the message.  Your code will start at the center, but you
need to subtract half of the height of the message (might be multi line),
and half of the width of the message (longest line) in order to be
"centered".

--
Fred

Quote:
> Something along the lines of this?

> local m.lnOldScaleMode
> m.lnOldScaleMode = _screen.scalemode
> _screen.scalemode = 0 &&Foxels
> Wait wind "Hello" at (_Screen.height/2),(_screen.width/2)
> _screen.scalemode = m.lnOldScaleMode

> HTH
> jeremy

> > Is there an easy formula to use that centers the WAIT WINDOW command?

> > WAIT WINDOW AT 20, ?? lcMessage

> > Thanks,
> > John Gundrum

Sat, 22 Feb 2003 23:50:15 GMT
Formula to Center WAIT WINDOW
I give this a whirl...

Thanks again!
John G.

Quote:
> Is there an easy formula to use that centers the WAIT WINDOW command?

> WAIT WINDOW AT 20, ?? lcMessage

> Thanks,
> John Gundrum

Sun, 23 Feb 2003 00:46:11 GMT
Formula to Center WAIT WINDOW

Hey John,

here is a simple way (and FAST) 4 line prog...
save it as winwait.prg

Just call it like this:-

do winwait with 'Oops I did it Again!'

It will autocenter both height & width...

If you just want it to be on the line where the cursor point
is, strip out the winHeight part.

Code:-
LPARAMETERS msg
winHeight=36
winWidth=150
WAIT WINDOW msg AT (winHeight/2) , ((winWidth-LEN(msg))/2)

Regards,
Derek

Quote:
> Something along the lines of this?

> local m.lnOldScaleMode
> m.lnOldScaleMode = _screen.scalemode
> _screen.scalemode = 0 &&Foxels
> Wait wind "Hello" at (_Screen.height/2),(_screen.width/2)
> _screen.scalemode = m.lnOldScaleMode

> HTH
> jeremy

> > Is there an easy formula to use that centers the WAIT WINDOW command?

> > WAIT WINDOW AT 20, ?? lcMessage

> > Thanks,
> > John Gundrum

Sun, 23 Feb 2003 01:39:36 GMT
Formula to Center WAIT WINDOW
To get it to Centre properly you would need this

local m.lnOldScaleMode
m.lnOldScaleMode = _screen.scalemode
_screen.scalemode = 0 &&Foxels
msg = ' This is in the centre of the screen '
Wait wind msg at (_Screen.height/2),((_screen.width/2)-(len(msg)/2))
_screen.scalemode = m.lnOldScaleMode

Quote:
> Something along the lines of this?

> local m.lnOldScaleMode
> m.lnOldScaleMode = _screen.scalemode
> _screen.scalemode = 0 &&Foxels
> Wait wind "Hello" at (_Screen.height/2),(_screen.width/2)
> _screen.scalemode = m.lnOldScaleMode

> HTH
> jeremy

> > Is there an easy formula to use that centers the WAIT WINDOW command?

> > WAIT WINDOW AT 20, ?? lcMessage

> > Thanks,
> > John Gundrum

Sun, 23 Feb 2003 07:22:59 GMT
Formula to Center WAIT WINDOW

VFP 7.0 MESSAGEBOX will have a timeout parameter...I don't know if you can
wait, or how precisely you need to center the message. I use a class to
place a wait window *near* a control. It's not precise, but gets close.
Perhaps there will be an idea there that will help if the other suggestions
don't. (Though they are nicely simple.)

**************************************************
*-- Class:        waitwindow (c:\nec\library\classes\waitwindow.vcx)
*-- ParentClass:  custom
*-- BaseClass:    custom
*-- Time Stamp:   12/07/99 12:03:11 PM
*--
*-- WaitWindow will place a normal wait window near the control that is
passed to this init().
*--
*-- (c) 1999 Pixel Dust Industries

*--
*-- Example:
*-- loWait = CREATEOBJECT( 'WaitWindow', 'Creating list of worksheets...',
this, thisform )
*--
DEFINE CLASS waitwindow AS custom

Name = "waitwindow"

PROCEDURE Init
*!* ASSUMPTIONS! "toThis" is assumed to be a control other than a form.
*!*     "toThisForm" is assumed to be a form not contained in a formset

LPARAMETER tcMessage, toThis, toThisForm
DO CASE
CASE PCOUNT() < 1
*!* There ain't nothin' to do
RETURN
CASE PCOUNT() < 2 && Just put up a regular wait window.
WAIT tcMessage WINDOW NOWAIT NOCLEAR
RETURN
CASE toThisForm.showWindow = 0 && We're using the _screen
lnRow = ( toThis.top + toThisForm.top + _screen.top + 2 * SYSMETRIC(
9 ) ) / ( ( _screen.height + SYSMETRIC( 9 ) ) / SROWS() )
lnCol = ( toThis.left + toThisForm.left + _screen.left + 2 * SYSMETRIC(
10 ) ) / ( ( _screen.width + SYSMETRIC( 10 ) ) / SCOLS() )
CASE toThisForm.showWindow = 1 && toThisForm is in a top-level form
lnRow = ( toThis.top + toThisForm.top + toThisForm.parent.top + 2 *
SYSMETRIC( 9 ) ) / ( ( toThisForm.parent.height + 2 * SYSMETRIC( 9 ) )/
WROWS( toThisForm.parent.name ) )
lnCol = ( toThis.left + toThisForm.left + toThisForm.parent.left + 2 *
SYSMETRIC( 10 ) ) / ( ( toThisForm.parent.width + 2 * SYSMETRIC( 10 ) ) /
WCOLS( toThisForm.parent.name ) )
OTHERWISE
&& toThisForm is a top-level form
lnRow = ( toThis.top + toThisForm.top + SYSMETRIC( 9 ) ) / (
toThisForm.height / WROWS( toThisForm.name ) )
lnCol = ( toThis.left + toThisForm.left + SYSMETRIC( 10 ) ) / (
toThisForm.width / WCOLS( toThisForm.name ) )
ENDCASE

WAIT tcMessage WINDOW AT lnRow + 2, lnCol + 2 NOWAIT NOCLEAR
ENDPROC

PROCEDURE Destroy
WAIT CLEAR
ENDPROC

ENDDEFINE
*
*-- EndDefine: waitwindow
**************************************************

--

Nancy

Please post replies to the newsgroup
so everybody benefits from the
discussion.

Best viewed with a non-proportional font.

Quote:
> Is there an easy formula to use that centers the WAIT WINDOW command?

> WAIT WINDOW AT 20, ?? lcMessage

> Thanks,
> John Gundrum

Tue, 25 Feb 2003 01:04:54 GMT
Formula to Center WAIT WINDOW

Quote:
> To get it to Centre properly you would need this

> local m.lnOldScaleMode
> m.lnOldScaleMode = _screen.scalemode
> _screen.scalemode = 0 &&Foxels
> msg = ' This is in the centre of the screen '
> Wait wind msg at (_Screen.height/2),((_screen.width/2)-(len(msg)/2))
> _screen.scalemode = m.lnOldScaleMode

*Sort of* centered, unfortunately.  And it doesn't work on multiline
expressions.

--

Nancy

Please post replies to the newsgroup
so everybody benefits from the
discussion.

Best viewed with a non-proportional font.

Tue, 25 Feb 2003 01:01:44 GMT

 Page 1 of 1 [ 11 post ]

Relevant Pages
 12. wait windows