Actualmente, el MSGRUN no separa en multiples líneas el texto cuando se le coloca CRLF, y me ví forzado a modificar el fuente original de la clase.
Sería posible Implementar esta característica en el fuente original???,
Se lograría estandarizar el comportamiento de los msg.
Saludos..
Angel.
MSGRUN
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
#include "FiveWin.ch"
#define DS_MODALFRAME 128 // 0x80
//----------------------------------------------------------------------------//
function WaitSeconds( nSecs )
local nStart := GetTickCount()
DEFAULT nSecs := 1
while GetTickCount() - nStart < ( 1000 * nSecs )
end
return nil
//----------------------------------------------------------------------------//
function MsgRun( cCaption, cTitle, bAction )
LOCAL oDlg, nWidth,aMsg:={},nArrayLeng:=0,cMsg
DEFAULT cCaption := "Espere, Por Favor...",;
bAction := { || WaitSeconds( 1 ) }
IF At( CRLF,cCaption ) != 0
DO WHILE At( CRLF,cCaption ) != 0
cMsg:=Left(cCaption,At( CRLF,cCaption )-1)
aadd(aMsg,cMsg)
nArrayLeng:=MAX(nArrayLeng,len(cMsg))
cCaption:=substr(cCaption,At( CRLF,cCaption )+1)
ENDDO
ENDIF
aadd(aMsg,cCaption)
nArrayLeng:=MAX(nArrayLeng,len(cCaption))
IF cTitle == NIL
DEFINE DIALOG oDlg ;
FROM 0,0 TO 2+LEN(aMsg) , nArrayLeng + 3 ;
STYLE nOr(WS_POPUP,DS_MODALFRAME) //nOr( DS_MODALFRAME, WS_POPUP )
ELSE
DEFINE DIALOG oDlg ;
FROM 0,0 TO 4+LEN(aMsg), Max( nArrayLeng, Len( cTitle ) ) + 4 ;
TITLE cTitle STYLE nOr(DS_MODALFRAME)
ENDIF
oDlg:lHelpIcon :=.f.
oDlg:bStart := { || Eval( bAction, oDlg ), oDlg:End(), SysRefresh() }
nWidth := oDlg:nRight - oDlg:nLeft
ACTIVATE DIALOG oDlg CENTER ;
ON PAINT PresMsg(oDlg,aMsg,nWidth)
return nil
STATIC FUNCTION PresMsg(oDlg,aMsg,nWidth)
LOCAL nAt
FOR nAt=1 to len(aMsg)
oDlg:Say( nAt, 0, xPadC( aMsg[nAt], nWidth ) )
NEXT
//----------------------------------------------------------------------------//
function MsgWait( cCaption, cTitle, nSeconds )
DEFAULT nSeconds := 4
return MsgRun( cCaption, cTitle, { || WaitSeconds( nSeconds ) } )
//----------------------------------------------------------------------------//
Function StopUntil( bBlock )
DO WHILE !Eval( bBlock )
WaitMessage()
SysRefresh()
ENDDO
Return NIL
NOTA: Aunque no es mut elegante, por lo menos trabaja
Saludos
#define DS_MODALFRAME 128 // 0x80
//----------------------------------------------------------------------------//
function WaitSeconds( nSecs )
local nStart := GetTickCount()
DEFAULT nSecs := 1
while GetTickCount() - nStart < ( 1000 * nSecs )
end
return nil
//----------------------------------------------------------------------------//
function MsgRun( cCaption, cTitle, bAction )
LOCAL oDlg, nWidth,aMsg:={},nArrayLeng:=0,cMsg
DEFAULT cCaption := "Espere, Por Favor...",;
bAction := { || WaitSeconds( 1 ) }
IF At( CRLF,cCaption ) != 0
DO WHILE At( CRLF,cCaption ) != 0
cMsg:=Left(cCaption,At( CRLF,cCaption )-1)
aadd(aMsg,cMsg)
nArrayLeng:=MAX(nArrayLeng,len(cMsg))
cCaption:=substr(cCaption,At( CRLF,cCaption )+1)
ENDDO
ENDIF
aadd(aMsg,cCaption)
nArrayLeng:=MAX(nArrayLeng,len(cCaption))
IF cTitle == NIL
DEFINE DIALOG oDlg ;
FROM 0,0 TO 2+LEN(aMsg) , nArrayLeng + 3 ;
STYLE nOr(WS_POPUP,DS_MODALFRAME) //nOr( DS_MODALFRAME, WS_POPUP )
ELSE
DEFINE DIALOG oDlg ;
FROM 0,0 TO 4+LEN(aMsg), Max( nArrayLeng, Len( cTitle ) ) + 4 ;
TITLE cTitle STYLE nOr(DS_MODALFRAME)
ENDIF
oDlg:lHelpIcon :=.f.
oDlg:bStart := { || Eval( bAction, oDlg ), oDlg:End(), SysRefresh() }
nWidth := oDlg:nRight - oDlg:nLeft
ACTIVATE DIALOG oDlg CENTER ;
ON PAINT PresMsg(oDlg,aMsg,nWidth)
return nil
STATIC FUNCTION PresMsg(oDlg,aMsg,nWidth)
LOCAL nAt
FOR nAt=1 to len(aMsg)
oDlg:Say( nAt, 0, xPadC( aMsg[nAt], nWidth ) )
NEXT
//----------------------------------------------------------------------------//
function MsgWait( cCaption, cTitle, nSeconds )
DEFAULT nSeconds := 4
return MsgRun( cCaption, cTitle, { || WaitSeconds( nSeconds ) } )
//----------------------------------------------------------------------------//
Function StopUntil( bBlock )
DO WHILE !Eval( bBlock )
WaitMessage()
SysRefresh()
ENDDO
Return NIL
NOTA: Aunque no es mut elegante, por lo menos trabaja
Saludos
Saludos
Angel, Valencia, Venezuela
xH .997 - FW 7.9 - BCC55 - WorkShop - MySql
Angel, Valencia, Venezuela
xH .997 - FW 7.9 - BCC55 - WorkShop - MySql