Que MsgRun() devuelva algo

Que MsgRun() devuelva algo

Postby RSalazarU » Fri Sep 30, 2011 11:25 am

Al equipo de FiveWin:

Acabo de obtener FWH 11.09 y quisiera pedirles un pequeño cambio.

Se podría hacer que MsgRun() devuelva el valor retornado por la evaluación de bAction ?

Code: Select all  Expand view

function MsgRun( cCaption, cTitle, bAction )

     LOCAL oDlg, nWidth, uRet //<---aca el cambio uRet

     DEFAULT cCaption := "Please, wait...",;
             bAction  := { || WaitSeconds( 1 ) }

     IF cTitle == NIL
          DEFINE DIALOG oDlg ;
               FROM 0,0 TO 3, Len( cCaption ) /*+ 4*/ ;
               STYLE nOr( DS_MODALFRAME, WS_POPUP )
     ELSE
          DEFINE DIALOG oDlg ;
               FROM 0,0 TO 4, Max( Len( cCaption ), Len( cTitle ) ) + 4 ;
               TITLE cTitle ;
               STYLE DS_MODALFRAME
     ENDIF

     oDlg:bStart := { || uRet:=Eval( bAction, oDlg ), oDlg:End(), SysRefresh() } //<---aca el cambio uRet
     oDlg:cMsg   := cCaption

     nWidth := oDlg:nRight - oDlg:nLeft

     ACTIVATE DIALOG oDlg CENTER ;
          ON PAINT oDlg:Say( 11, 0, xPadC( oDlg:cMsg, nWidth ),,,, .T. )

return uRet //<---aca el cambio uRet
 


De esta forma se podria hacer: cosa como:

Code: Select all  Expand view

:
if MsgRun(,,{|| lVerifica() })
   msginfo("Exito")
else
   msginfo("Fallo")
endif
:

Function lVerifica()
   if date() < CTOD("01/01/2012")
      return .T.
   endif
   return .F.

 


Atentamente,

Rolando.

Saludos desde Cochabamba, Bolivia.
RSalazarU
 
Posts: 211
Joined: Wed Jul 16, 2008 12:59 pm
Location: Cochabamba-Bolivia

Re: Que MsgRun() devuelva algo

Postby Daniel Garcia-Gil » Fri Sep 30, 2011 11:54 am

Hola

prueba este cambio, a ver si lo incluimos en la proxima version

Code: Select all  Expand view

function MsgRun( cCaption, cTitle, bAction )

     LOCAL oDlg, nWidth, uReturn

     DEFAULT cCaption := "Please, wait...",;
             bAction  := { || WaitSeconds( 1 ) }

     IF cTitle == NIL
          DEFINE DIALOG oDlg ;
               FROM 0,0 TO 3, Len( cCaption ) + 4 ;
               STYLE nOr( DS_MODALFRAME, WS_POPUP )
     ELSE
          DEFINE DIALOG oDlg ;
               FROM 0,0 TO 4, Max( Len( cCaption ), Len( cTitle ) ) + 4 ;
               TITLE cTitle ;
               STYLE DS_MODALFRAME
     ENDIF

     oDlg:bStart := { || uReturn := Eval( bAction, oDlg ), oDlg:End(), SysRefresh() }
     oDlg:cMsg   := cCaption

     nWidth := oDlg:nRight - oDlg:nLeft

     ACTIVATE DIALOG oDlg CENTER ;
          ON PAINT oDlg:Say( 11, 0, xPadC( oDlg:cMsg, nWidth ),,,, .T. )

return uReturn
 
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 32 guests