>**************************************************************************** >* >* PROGRAM NAME: WaitWCtr.prg >* >* AUTHOR: Richard A. Schummer, August 1996 >* >* COPYRIGHT © 1996 All Rights Reserved. >* Richard A. Schummer >* 42759 Flis Dr. >* Sterling Heights, MI 48314-2850 >* RSchummer@CompuServe.com >* >* The routine was made available via the DAFUG Newsletter and on >* CompuServe so all in the FoxPro community could benefit from it. >* >* PROGRAM DESCRIPTION: >* This program centers a WAIT WINDOW message based on the position >* of the Visual FoxPro frame using the new (*row*), (*col*) functionality >* of the WAIT WINDOW. If the first parameter (actual message) is not >* sent, the routine does not execute. >* >* CALLED BY: >* =WaitWCtr((*txMsg*), (*tlNoWait*)) >* >* SAMPLE CALL: >* =WaitWCtr("Send Rick lots of cash", .T.) >* >* INPUT PARAMETERS: >* txMsg = Required parameter, this is the message that is displayed >* in the WAUT WINDOW. This parameter can be any type, the >* routine will convert the value to one that can be displayed >* in the WAIT WINDOW. If not sent the routine quits without >* a message displayed. >* tlNoWait = Optional parameter, defaults to .F., if .T. the WAIT WINDOW >* becomes a NOWAIT window. >* >* OUTPUT PARAMETERS: >* None >* >* DATABASES ACCESSED: >* None >* >* GLOBAL VARIABLES REQUIRED: >* None >* >* GLOBAL PROCEDURES REQUIRED: >* None >* >* DEVELOPMENT STANDARDS: >* Version 2.1 compliant >* >* TEST INFORMATION: >* None >* >* SPECIAL REQUIREMENTS/DEVICES: >* None >* >* FUTURE ENHANCEMENTS: >* None >* >* LANGUAGE/VERSION: >* Visual FoxPro 3.x or higher > >* >**************************************************************************** >* >* C H A N G E L O G >* >* Date SE System Description >* ---------- ---------------------- ------- ----------------------------- >* 08/05/1996 Richard A. Schummer Common Created program >* -------------------------------------------------------------------------- >* 08/25/1996 Richard A. Schummer Common Fixed TYPE() bugs, added >* NOWAIT capability and header >* -------------------------------------------------------------------------- >* 09/27/1997 Ken Downs Always in NOWAIT, explicitly set the value of 2nd parameter >* 01/25/1999 Ken Downs Moved into Active FrameworX >**************************************************************************** >LPARAMETER txMsg, tlNoWait > > >DO CASE > CASE PARAMETERS() = 0 > RETURN > CASE PARAMETERS() = 1 > tlNoWait = .F. >ENDCASE > >tlNoWait = .t. > > >LOCAL lcNoWait && Used for macro expansion fo NOWAIT >LOCAL lcMsgFontName && FontName built into the VFP WAIT >*WINDOW >LOCAL lnMsgFontSize && FontSize built into the VFP WAIT >*WINDOW >LOCAL lcMsgStyle && Font Style built into the VFP WAIT >*WINDOW >LOCAL lnMsgWidth && Calculated length of message in >*columns >LOCAL lnMsgRow && Calculated position of message in >*rows >LOCAL lnMsgCol && Calculated position of message in >*cols >LOCAL lcScreenStyle && Font Style (Bold and Italic) for >*_SCREEN > >* Determine macro expansion foe NOWAIT >IF tlNoWait > lcNoWAIT = "NOWAIT" >ELSE > lcNoWAIT = "" >ENDIF > >* Convert message to character for display >DO CASE > CASE TYPE("txMsg") = "C" > CASE TYPE("txMsg") = "L" > txMsg = IIF(txMsg, "Yes", "No") > CASE TYPE("txMsg") = "N" > txMsg = ALLTRIM(STR(txMsg,20,3)) > CASE TYPE("txMsg") = "Y" > txMsg = ALLTRIM(STR(txMsg,20,4)) > CASE TYPE("txMsg") = "D" > txMsg = DTOC(txMsg) > CASE TYPE("txMsg") = "T" > txMsg = TTOC(txMsg) > CASE TYPE("txMsg") = "O" > txMsg = "(Object)" > CASE TYPE("txMsg") = "M" > txMsg = "(Memo)" > CASE TYPE("txMsg") = "G" > txMsg = "(General)" > OTHERWISE && Undefined, > RETURN >ENDCASE > >* Calculate position for WAIT WINDOW >lcMsgFontName = "MS San Serif" >lnMsgFontSize = 8 >lcMsgStyle = "B" > >lnMsgWidth = TXTWIDTH(txMsg, ; > lcMsgFontName, ; > lnMsgFontSize, ; > lcMsgStyle) > >lnMsgRow = ((WROWS("SCREEN")- ; > FONTMETRIC(1,lcMsgFontName,; > lnMsgFontSize,; > lcMsgStyle ) /; > FONTMETRIC(1)) / 2) + ; > FONTMETRIC(9) + ; > FONTMETRIC(9) + 2 >lnMsgCol = (WCOLS("SCREEN")- lnMsgWidth * ; > FONTMETRIC(6,lcMsgFontName,; > lnMsgFontSize,; > lcMsgStyle ) /; > FONTMETRIC(6)) / 2 - ; > 3 > >lcScreenStyle = "" >lcScreenStyle = lcScreenStyle + ; > IIF(_SCREEN.FontBold, "B","") >lcScreenStyle = lcScreenStyle + ; > IIF(_SCREEN.FontItalic, "I","") > >* Adjust to position in the VFP Frame since the >* WAIT WINDOW Row and Column reference the >* actual desktop. > >lnMsgRow = lnMsgRow + ; > (_SCREEN.Top / ; > FONTMETRIC(1,_SCREEN.FontName, ; > _SCREEN.FontSize, ; > lcScreenStyle)) >lnMsgCol = lnMsgCol + ; > (_SCREEN.Left / ; > FONTMETRIC(6,_SCREEN.FontName, ; > _SCREEN.FontSize, ; > lcScreenStyle)) > >WAIT WINDOW txMsg AT lnMsgRow, lnMsgCol &lcNoWAIT > >RETURN >