FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Error en MsgRun
Posts: 187
Joined: Mon Oct 20, 2008 06:33 PM
Error en MsgRun
Posted: Wed Apr 10, 2013 10:17 AM

Error en MsgRun:

Si el segundo parámetro / título es muy grande, la devuelve MsgRun erero GPF.

Modificada por la limitación del tamaño del título a la anchura de la ventana para evitar este error.

Me parece interesante que se corrija esta característica en futuras versiones.

Gracias,

Oscar

Oscar Ribeiro

OASyS Informática

Fwh18.02 + xHarbour 1.2.3 + Bcc72
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Error en MsgRun
Posted: Wed Apr 10, 2013 02:06 PM
Oscar vc. não reportou qual é o erro de GPF.

Qual é o tamanho da mensagem??

Tentou modificar a MSGRUN.PRG original do seu FIVE?

Oscar, vc. pode modificar a gosto e incluir ao seu projeto, veja que modifiquei a minha MSGRUN.PRG para meu gosto pessoal.

Code (fw): Select all Collapse
/*
    MsgWait y MsgRun no se muestran correctamente bajo 32 bits, el
    cálculo de coordenadas no es correcto pues el texto de cuerpo
    se recorta:

    Moises,

    En source\function\msgrun.prg hay que modificar estas líneas asi:

    Código:

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

    Antonio Linares
    <!-- w --><a class="postlink" href="http://www.fivetechsoft.com">www.fivetechsoft.com</a><!-- w -->
*/

#Include "FiveWin.Ch"

//----------------------------------------------------------------------------//

Function WaitSeconds( nSecs )

    Local nStart := GetTickCount()

    DEFAULT nSecs := 1

    While GetTickCount() - nStart < ( 1000 * nSecs )
    Enddo

Return Nil

//---------------------------------------------------------------------------//

Function MsgRun( cCaption, cTitle, bAction )

    Local oDlg, nWidth, oFnt, oFont, oBrush

    DEFAULT cCaption := "Por Favor, Espere...     ",;
            bAction  := { || WaitSeconds( 1 ) }

    DEFINE FONT oFnt    NAME "Ms Sans Serif" SIZE 0, -12 BOLD
    DEFINE FONT oFont   NAME "Ms Sans Serif" SIZE 0, -14 BOLD

    IF cTitle == Nil

        DEFINE DIALOG oDlg                          ;
               FROM 0,0 TO 3, Len( cCaption ) + 4   ;
               STYLE nOr( DS_MODALFRAME, WS_POPUP ) ;
               COLOR nRGB( 000, 000, 000 ), nRGB( 135, 206, 235 )

        oDlg:lHelpIcon := .F. // ok

     ELSE

        DEFINE DIALOG oDlg                                              ;
               FROM 0,0 TO 4, Max( Len( cCaption ), Len( cTitle ) ) + 4 ;
               TITLE cTitle                                             ;
               STYLE nOR( DS_MODALFRAME )                               ;
               COLOR nRGB( 000, 000, 000 ), nRGB( 135, 206, 235 )

        oDlg:lHelpIcon := .F. // ok

    ENDIF

    oDlg:bKeyDown = { | nKey | IF( nKey == VK_ESCAPE, ( oDlg:End() ), ) }

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

    nWidth := oDlg:nRight - oDlg:nLeft

    SET FONT OF oDlg TO oFnt

    //-> Modificado By Antonio Linares 26/10/2007 - Correcao de Bug
    ACTIVATE DIALOG oDlg CENTERED ;
             ON PAINT oDlg:Say( 11, 0, xPadC( oDlg:cMsg, nWidth ),,,, .T. )

    oFnt:End()
    oFont:End()

RETURN NIL

//---------------------------------------------------------------------------//

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

//---------------------------------------------------------------------------//


Abs, saudações, saludos, regards.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 187
Joined: Mon Oct 20, 2008 06:33 PM
Re: Error en MsgRun
Posted: Tue Apr 16, 2013 10:11 AM

O problema está quando o texto passado para a função é muito grande, maior do que a largura da tela.
Vou modificar a função e adicioná-la no meu sistema seguindo a sua sugestão.
Obrigado,
Oscar

Oscar Ribeiro

OASyS Informática

Fwh18.02 + xHarbour 1.2.3 + Bcc72
Posts: 187
Joined: Mon Oct 20, 2008 06:33 PM
Re: Error en MsgRun
Posted: Tue Apr 16, 2013 10:58 AM
Modifiquei aqui:

Code (fw): Select all Collapse
      DEFINE DIALOG oDlg                                              ;
             FROM 0,0 TO 4, Max( Len( cCaption ), Len( cTitle ) ) + 4 ;
             TITLE Alltrim(PadR(cTitle, 110))                         ; // OASyS: Mudei aqui para evitar erro GPF quando título é muito grande: TITLE cTitle ;
             STYLE nOR( DS_MODALFRAME )                               ;
             COLOR nRGB( 000, 000, 000 ), nRGB( 135, 206, 235 )


Exemplo que dá erro:
MsgRunxx('Aguarde ','Abrindo Arquivo PDF. Aguarde por favor... sdfkj s lskjf slçkf jsdlçkf jf çsj ldj sdçjsdl sdl sdlksf lksjf lsçkj ldç jfsdf çsljfçlsdkjf lçskj çlsdjf djsdlçfjsçfjsçlfjslçjsçljsçlj'+;
'Abrindo Arquivo PDF. Aguarde por favor... sdfkj s lskjf slçkf jsdlçkf jf çsj ldj sdçjsdl sdl sdlksf lksjf lsçkj ldç jfsdf çsljfçlsdkjf lçskj çlsdjf djsdlçfjsçfjsçlfjslçjsçljsçlj',;
{|| MsgInfo("Teste com erro no MSGRUN")})
Oscar Ribeiro

OASyS Informática

Fwh18.02 + xHarbour 1.2.3 + Bcc72
Posts: 187
Joined: Mon Oct 20, 2008 06:33 PM
Re: Error en MsgRun
Posted: Tue Apr 16, 2013 07:27 PM

Na verdade o erro está na classe DIALOG.
Se enviar um TITLE muito grande dá erro GPF.

Oscar Ribeiro

OASyS Informática

Fwh18.02 + xHarbour 1.2.3 + Bcc72
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Error en MsgRun
Posted: Tue Apr 16, 2013 08:35 PM
ORibeiro wrote:Na verdade o erro está na classe DIALOG.
Se enviar um TITLE muito grande dá erro GPF.


Está correto, se você colocar a mensagem no CAPTION da DIALOG usando o WORKSHOP.EXE, verá que ele tem um LIMITE DE CARACTERES.

abs,
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Error en MsgRun
Posted: Wed Apr 17, 2013 06:27 AM

If we could know the max size allowed (trying with different values before it GPFs) then we could set the same limitation in FWH code :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 187
Joined: Mon Oct 20, 2008 06:33 PM
Re: Error en MsgRun
Posted: Wed Apr 17, 2013 10:26 AM
Antonio,
O limite é 104 caracteres.
Code (fw): Select all Collapse
#include "FiveWin.ch"
function Main()
   local oDlg, oIco, cTest := "Hello world! OASyS"
   DEFINE ICON oIco FILE "..\icons\fivewin.ico"
   DEFINE DIALOG oDlg;
          TITLE "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"+;
                "12345678901234"; // ==> Limite 104 caracteres
          COLOR "W+/B" ;
          ICON oIco
   @ 1, 3 GET cTest
   @ 3, 5 BUTTON "&Ok" SIZE 40,12 ACTION MsgInfo( "Any action here!" ) DEFAULT
   @ 3, 16 BUTTON "&Cancel" SIZE 40, 12 ACTION oDlg:End()
   ACTIVATE DIALOG oDlg CENTERED VALID MsgYesNo( "Do you want to end ?" )
return nil
Oscar Ribeiro

OASyS Informática

Fwh18.02 + xHarbour 1.2.3 + Bcc72
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Error en MsgRun
Posted: Wed Apr 17, 2013 02:07 PM
Oscar,

gracias. Entonces podemos modificar la función MsgRun() asi:

Code (fw): Select all Collapse
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 SubStr( cTitle, 1, Max( Len( cTitle ), 140 ) ) ;
               STYLE DS_MODALFRAME
     ...
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 187
Joined: Mon Oct 20, 2008 06:33 PM
Re: Error en MsgRun
Posted: Thu Apr 18, 2013 10:22 AM

Será mejor que modifico el DIALOG.PRG clase.
El problema es con la creación del título del diálogo superior a 140.

Oscar Ribeiro

OASyS Informática

Fwh18.02 + xHarbour 1.2.3 + Bcc72
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Error en MsgRun
Posted: Thu Apr 18, 2013 10:49 AM

Oscar,

Si, tienes razón, es más práctico cambiarlo en la Clase TDialog, gracias :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 187
Joined: Mon Oct 20, 2008 06:33 PM
Re: Error en MsgRun
Posted: Fri Apr 19, 2013 10:22 AM

Gracias Antonio,
Voy a esperar a su ajuste en la clase.

Oscar Ribeiro

OASyS Informática

Fwh18.02 + xHarbour 1.2.3 + Bcc72
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Error en MsgRun
Posted: Fri Apr 19, 2013 10:40 AM
regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion