Error en MsgRun

Error en MsgRun

Postby ORibeiro » 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
User avatar
ORibeiro
 
Posts: 187
Joined: Mon Oct 20, 2008 6:33 pm
Location: Itu, Sao Paulo, Brazil

Re: Error en MsgRun

Postby karinha » Wed Apr 10, 2013 2: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: Select all  Expand view

/*
    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
    www.fivetechsoft.com
*/


#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
User avatar
karinha
 
Posts: 7353
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Error en MsgRun

Postby ORibeiro » 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
User avatar
ORibeiro
 
Posts: 187
Joined: Mon Oct 20, 2008 6:33 pm
Location: Itu, Sao Paulo, Brazil

Re: Error en MsgRun

Postby ORibeiro » Tue Apr 16, 2013 10:58 am

Modifiquei aqui:

Code: Select all  Expand view

      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
User avatar
ORibeiro
 
Posts: 187
Joined: Mon Oct 20, 2008 6:33 pm
Location: Itu, Sao Paulo, Brazil

Re: Error en MsgRun

Postby ORibeiro » Tue Apr 16, 2013 7: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
User avatar
ORibeiro
 
Posts: 187
Joined: Mon Oct 20, 2008 6:33 pm
Location: Itu, Sao Paulo, Brazil

Re: Error en MsgRun

Postby karinha » Tue Apr 16, 2013 8: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
User avatar
karinha
 
Posts: 7353
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Error en MsgRun

Postby Antonio Linares » Wed Apr 17, 2013 6: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41414
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Error en MsgRun

Postby ORibeiro » Wed Apr 17, 2013 10:26 am

Antonio,
O limite é 104 caracteres.
Code: Select all  Expand view

#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
User avatar
ORibeiro
 
Posts: 187
Joined: Mon Oct 20, 2008 6:33 pm
Location: Itu, Sao Paulo, Brazil

Re: Error en MsgRun

Postby Antonio Linares » Wed Apr 17, 2013 2:07 pm

Oscar,

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

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 SubStr( cTitle, 1, Max( Len( cTitle ), 140 ) ) ;
               STYLE DS_MODALFRAME
     ...
 
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41414
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Error en MsgRun

Postby ORibeiro » 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
User avatar
ORibeiro
 
Posts: 187
Joined: Mon Oct 20, 2008 6:33 pm
Location: Itu, Sao Paulo, Brazil

Re: Error en MsgRun

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 41414
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Error en MsgRun

Postby ORibeiro » 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
User avatar
ORibeiro
 
Posts: 187
Joined: Mon Oct 20, 2008 6:33 pm
Location: Itu, Sao Paulo, Brazil

Re: Error en MsgRun

Postby Antonio Linares » Fri Apr 19, 2013 10:40 am

Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41414
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 40 guests