Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Wait window Position Query
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows Server 2003
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01565854
Message ID:
01566069
Views:
74
This message has been marked as a message which has helped to the initial question of the thread.
>I have a grid where data is entered into. If the user enters invalid data I want to place a wait window near the row and column where the incorrected data is entered with a message. Is there a way I can determine the X and Y co-ordinates of where the cursor is and display the wait window command?
>
>Is there perhaps a better way of doing this?
>
>Thanks in advance

You can use this function to show the WAIT WINDOWS centered on VFP Screen.

PS: Sorry for the language of the comments (Spanish), but very readable code
lcTexto = "Espere un momento ..." + CHR(13) + ;
  "generando el informe del día " + TRANSFORM(DATE()) + CHR(13) + ;
  "NADA CORRE COMO UN ZORRO"

? WaitWindowsCentrado()

? WaitWindowsCentrado(lcTexto,,5)

? WaitWindowsCentrado(lcTexto,"NOWAIT")

*------------------------------------------------------
* FUNCTION WaitWindowsCentrado(tcTexto, tcOpc, tnTimeout)
* - - - - - - - - - - - - - - - - - - - - - - - - - - -
* Muestra la ventana de WAIT WINDOWS centrada
* USO: WaitWindowsCentrado(tcTexto, tcOpc, tnTimeOut)
* EJEMPLO: WaitWindowsCentrado("Espere un momento...", "NOWAIT", 0)
* RETORNA: Caracter
* AUTOR: LMG
*------------------------------------------------------
FUNCTION WaitWindowsCentrado(tcTexto, tcOpc, tnTimeOut)

  LOCAL lnMaxLen, lnNroLin, lnRelFil, lnRelCol, ;
    lnRows_VFP, lnFil, lnCol, lcRet, lcCmd, ln, la(1)

  *-- Texto del mensaje
  IF EMPTY(tcTexto)
    tcTexto = "Presione una tecla para continuar..."
  ENDIF

  *-- Linea mas larga de tcTexto (si es multilinea)
  lnMaxLen = 0
  lnNroLin = ALINES(la, tcTexto)
  FOR ln = 1 TO lnNroLin
    lnMaxLen = MAX(lnMaxLen,LEN(la(ln)))
  ENDFOR

  *-- Filas de ventana completa _VFP, distinto a WROWS(_SCREEN.NAME)
  lnRows_VFP = _VFP.HEIGHT / FONTMETRIC(1,_SCREEN.FONTNAME,_SCREEN.FONTSIZE)

  *-- Relación entre el tamaño de las
  *-- fuentes de WAIT WINDOWS y _SCREEN
  lnRelFil = FONTMETRIC(1,'Arial',9) / FONTMETRIC(1,_SCREEN.FONTNAME,_SCREEN.FONTSIZE)
  lnRelCol = FONTMETRIC(6,'Arial',9) / FONTMETRIC(6,_SCREEN.FONTNAME,_SCREEN.FONTSIZE)
  lnFil = WLROW(_SCREEN.NAME) + (lnRows_VFP - lnNroLin * lnRelFil) / 2
  lnCol = WLCOL(_SCREEN.NAME) + (WCOLS(_SCREEN.NAME) - lnMaxLen * lnRelCol) / 2

  *-- Armo el Comando
  lcCmd = [WAIT WINDOWS tcTexto TO lcRet AT lnFil,lnCol]

  *-- Cláusulas NOWAIT y NOCLEAR
  IF NOT EMPTY(tcOpc) AND VARTYPE(tcOpc) = "C"
    IF "NOWA" $ UPPER(tcOpc)
      lcCmd = lcCmd + [ NOWAIT]
    ENDIF
    IF "NOCL" $ UPPER(tcOpc)
      lcCmd = lcCmd + [ NOCLEAR]
    ENDIF
  ENDIF

  *-- Cláusula TIMEOUT
  IF NOT EMPTY(tnTimeOut) AND VARTYPE(tnTimeOut) = "N"
    lcCmd = lcCmd + [ TIMEOUT tnTimeOut]
  ENDIF

  *-- Ejecuto el comando
  &lcCmd

  RETURN lcRet
ENDFUNC
Luis María Guayán
Tucumán, Argentina
________________________________
SysOp de www.PortalFox.com
Nada corre como un zorro
________________________________
Previous
Reply
Map
View

Click here to load this message in the networking platform