Page 1 of 1

Problema GPF

Posted: Sat Feb 07, 2009 10:42 am
by ik1mtt
Hola.

Tengo un problema GPF.

Lo que provoca el crash total es un SAY situado dentro de una Función
llamada por ON CHANGE de Listbox.

Me explico mejor con este listado:

-----

@ 11, 7.5 LISTBOX oLbx FIELDS;
nomin,nome,via,cap,citta,pr,loca,country,i_email;
HEADERS "Call", "Nome", "Indirizzo", "Cap", "Citta'", "Pr",;
"Locator", "Country", "Email";
FIELDSIZES 55, 170, 180, 50, 130, 30, 60, 100, 280;
SIZE 342,176;
FONT oFont OF oDlg;
ON CHANGE e_Loca(oDlg);
PIXEL

*--------------------------
Function E_loca( oLbx )

*
*//Calculo Km
*
---------
DEFINE FONT oFont2 NAME "Roman" SIZE 7, 16

@ 30.8, 3.5 SAY "Qrb Km:"+Qrb FONT oFont2 OF oLbx SIZE 130,17[/color] <--- aquí hay el problema
---------

Return Nil
---------

Si quito la línea con Say, todo anda bien..

Después del crash sale una ventana con estos errores:

Fivewin for Harbour GPF occured:

Called from TSAY:WINDOW(0)
Called from TSAY:HANDLEEVENT(0)
Called from TSAY:HANDLEEVENT(0)
Called from _FWH(0)
Called from SENDMESSAGE(0)
Called from TSAY:SETFONT(0)
Called from TSAY:INITIATED(0)
Called from TSAY:INITIATED(0)
Called from OBJSENDMSG(0)
Called from OSEND(0)
Called from ASEND(0)
Etc....

He hecho un test con Win 98, Xp y con dos Pc,
siempre me sale el mismo problema.

Uso FWH 26 April + Harbour o Xharbour con sus librerías.

¿Puede alguien ayudarme?

Muchas gracias...

Marco - Turin - Italia.

Re: Problema GPF

Posted: Sat Feb 07, 2009 11:02 am
by Antonio Linares
Marco,

Hazlo de esta forma:

Code: Select all

Function E_loca( oLbx )

   static oSay

   if oSay == nil
      DEFINE FONT oFont2 NAME "Roman" SIZE 7, 16

      @ 30.8, 3.5 SAY oSay PROMPT "Qrb Km:"+Qrb FONT oFont2 OF oLbx SIZE 130, 17
   else
       oSay:SetText( "Qrb Km:"+Qrb )
   endif

Return Nil

Re: Problema GPF

Posted: Sat Feb 07, 2009 12:31 pm
by ik1mtt
Gracias Antonio.

Lamentablemente sigue el mismo error....

Si cambio ON CHANGE con ON CLICK, anda perfectamente,
pero debo usar ON CHANGE...

Aunque sólo escribo:

@ 30.8, 3.5 SAY oSay Prompt "Qrb Km" OF oLbx

me sale el error.

Y pensar que tengo otros Say en mi prg y andan al 100%...

Ciao.

Re: Problema GPF

Posted: Sat Feb 07, 2009 2:17 pm
by Antonio Linares
Puedes publicar aqui el PRG completo de ese dialogo ? gracias

Re: Problema GPF

Posted: Sat Feb 07, 2009 6:42 pm
by ik1mtt
Ésta es la parte de mi prg donde me sale el error....

----------------------

#pragma BEGINDUMP
#include "windows.h"
#include "math.h"
#include "hbapi.h"

HB_FUNC( TANG ) //Aggiunta funzione aTan
{
hb_retnd((double) tan((double)hb_parnd(1) ));
}
HB_FUNC( ATN )
{
hb_retnd((double) atan((double)hb_parnd(1)));
}
HB_FUNC( COS )
{
hb_retnd((double) cos((double)hb_parnd(1)));
}
HB_FUNC( ACOS )
{
hb_retnd((double) acos((double)hb_parnd(1)));
}
HB_FUNC( SIN )
{
hb_retnd((double) sin((double)hb_parnd(1)));
}

#pragma ENDDUMP

#include "FiveWin.ch"

*--------------------
Function Main()

REQUEST DBFCDX

local oWnd, oBpm, oBrush

If ! file("Loca.mem") && Crea variabile
Pr_LocaMio="JN34QS"
Pr_cDrv := "C:\Dati"
Save all like Pr_* to Loca
Else
Restore from Loca.mem
Endif

drcu:=curdrive()

DEFINE FONT oFont NAME "Roman" SIZE 22, 32
DEFINE FONT oFont1 NAME "Roman" SIZE 15, 20

DEFINE BRUSH oBrush STYLE NULL

DEFINE WINDOW oWnd TITLE "Wcall2009 Ver. 1.0";
ICON "cd-10.ico" BRUSH oBrush

DEFINE BUTTONBAR obar 3D OF oWnd SIZE 37,42

DEFINE BUTTON of obar;
FILENAME 'Ita32.bmp';
ACTION c_callb();
TOOLTIP "Calbook Italiano";
MESSAGE "Calbook Italiano"

@ 0, 0 BITMAP oBmp FILENAME 'Insta.bmp' OF oWnd;
NO BORDER;
ADJUST

ACTIVATE WINDOW oWnd maximized;
ON PAINT ( oBmp:aDjClient(), oBmp:ScrollAdjust() )

Return nil

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

Function C_callb

local oDlg
local oLbx, oFont, oSay
local n
local oRs, cSay

Tipo:=""

If lIsDir(Pr_cDrv) = .f.

SettaIni()

Setcurdrive(substr(Pr_cDrv,1,1))

if lIsDir(Pr_cDrv) = .f.
Msgstop('Cartella "DATI" non trovata',"Attenzione!")
Return nil
Endif

Else

Setcurdrive(substr(Pr_cDrv,1,1))

Endif

SET DEFAULT TO \DATI

Select 1

USE italy.bok VIA "DBFCDX"

SET DEFAULT TO

Setcurdrive(Drcu)

if ! File( "italy.cdx" )

Indici()

endif

Select 1

SET Index TO Italy

Set order to 1

GO TOP

DEFINE FONT oFont NAME "Roman" SIZE 0, 14

DEFINE DIALOG oDlg FROM 4, 2 TO 32, 89.0 TITLE "Callbook Italia"

@ 0, 1 SAY " Call Italiani" OF oDlg

@ 11.99, 1.45 SAY "Qrb Km: 0"

@ 11, 7.5 LISTBOX oLbx FIELDS;
nomin,nome,via,cap,citta,pr,loca,country,i_email;
HEADERS "Call", "Nome", "Indirizzo", "Cap", "Citta'", "Pr",;
"Locator", "Country", "Email";
FIELDSIZES 55, 170, 180, 50, 130, 30, 60, 100, 280;
SIZE 342,176;
FONT oFont OF oDlg;
ON CHANGE E_Loca(oDlg);
PIXEL


oLbx:nClrBackHead:=nRgb(0,130,250)
oLbx:nClrForeHead:=nRgb(0,0,0)
oLbx:nClrBackFocus:=nRgb(0,100,255)
oLbx:nClrForeFocus:=nRgb(255,255,255)

oLbx:nClrText= { || iif( deleted(), CLR_GRAY, CLR_BLUE ) }

oLbx:nClrPane := {|| iif( Substr(nome,1,10)="SILENT KEY" .OR. Substr(nome,1,10)="Silent key",;
nRGB( 150, 200, 050 ), nRGB( 255, 255, 255 ) )}

oLbx:nLineStyle := 3

// Uncomment this to quickly calculate the desired columns width
// Right click with the mouse over the browse and you will
// see the columns sizes!
// oLbx:bRClicked = { || oLbx:ShowSizes() }



* @ 10.5, 10.0 BUTTON "&Scheda" OF oDlg ACTION EditNomiit( oLbx, .t. ) ;
* SIZE 50, 12

* @ 10.5, 20.0 BUTTON "&Ricerca" OF oDlg ACTION RecSearch( oLbx, olbx:gotop() ) SIZE 50, 12

* @ 10.5, 30.0 BUTTON "S&tampa" OF oDlg ;
* ACTION Stampa( oLbx, oLbx:GotFocus() ) SIZE 50, 12


@ 10.8, 40.0 BUTTON "&Uscita" OF oDlg ACTION oDlg:End() SIZE 50, 12


ACTIVATE DIALOG oDlg

USE

oFont:end()
oLbx:end()

Return NIL

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

Function E_loca( oLbx )

Static oSay

Local oFont2

dx:=0

If ! Empty(Loca)
locato5:=loca
dx:=0
Visloca()
Endif

Qrb:=str(dx,5)

if oSay == nil
DEFINE FONT oFont2 NAME "Roman" SIZE 7, 16

@ 25.99, 1.55 SAY oSay PROMPT "Qrb Km:"+Qrb FONT oFont2 OF oLbx SIZE 130, 17

else
oSay:SetText( "Qrb Km:"+Qrb )
endif

Return nil

*--------------------------------------------------------------------------

Function Indici()

If lIsDir(Pr_cDrv) = .f.

SettaIni()

Setcurdrive(substr(Pr_cDrv,1,1))

if lIsDir("\dati") = .f.
Msgstop('Cartella "DATI" non trovata',"Attenzione")
Quit
Endif

Else

Setcurdrive(substr(Pr_cDrv,1,1))

Endif

SET DEFAULT TO \DATI

USE italy.bok VIA "DBFCDX"

SET DEFAULT TO

Setcurdrive(Drcu)

Erase italy.cdx

MsgMeter( { | oMeter, oText, oDlg, lEnd | ;
IF(.NOT.INDSCC( oMeter, oText, oDlg, @lEnd ) , ;
WINDEXOU:=.F. ,.T. ) } , ;
"Ricostruzuine Indici ...........","Attendere" )

*---------------------
Function Indscc( oMeter, oText, oDlg, lEnd )

oMeter:nTotal = RecCount()

@0.4,1 say " Ricostruzione Indice Call 01/05 - Attendere" of odlg
INDEX ON nomin TAG _nomin TO italy EVAL ( oMeter:Set( RecNo() ), SysRefresh(), ! lEnd )

@0.4,1 say " Ricostruzione Indice Nome 02/05 - Attendere" of odlg
INDEX ON nome TAG _nome TO italy EVAL ( oMeter:Set( RecNo() ), SysRefresh(), ! lEnd )

@0.4,1 say " Ricostruzione Indice C.a.p. 03/05 - Attendere" of odlg
INDEX ON cap TAG _cap TO italy EVAL ( oMeter:Set( RecNo() ), SysRefresh(), ! lEnd )

@0.4,1 say " Ricostruzione Indice Citta' 04/05 - Attendere" of odlg
INDEX ON citta TAG _citta TO italy EVAL ( oMeter:Set( RecNo() ), SysRefresh(), ! lEnd )

@0.4,1 say " Ricostruzione Indice Provincia 05/05 - Attendere" of odlg
INDEX ON pr TAG _pr to italy EVAL ( oMeter:Set( RecNo() ), SysRefresh(), ! lEnd )

Close databases

RETU .T.

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

Function SettaIn2()

Memvar Pr_cDrv

if MsgGet( "Settaggio", "Inserire Drive Corretto", @Pr_cDrv,;
"driv32.bmp" )

Save all like Pr_* to Loca

Setcurdrive(substr(Pr_cDrv,1,1))

if lIsDir("\dati") = .f.
Msgstop('Cartella "DATI" non trovata',"Attenzione")
Quit
Endif

Endif
Return nil
//----------------------------------------------------------------------------//

Function SettaIni()

Memvar Pr_cDrv

if MsgGet( "Settaggio", "Inserire Drive Corretto", @Pr_cDrv,;
"driv32.bmp" )

Save all like Pr_* to Loca

Endif

Return nil

*-----------------
FUNC Visloca

Set decimals to 7
FA = 40009
P = 3.14/180
F = FA/(2*3.1415926)
Store 0 to NP,TP,TX,BF,LF,LE

*Locato:="JN34QS" //lo cerca da archivio

Locato:=Pr_LocaMio

Locato1:=Locato
If locato = " "
Return
Endif
Calco()
BE=BF
LE=LF
locato:=locato5
Locato2:=Locato
Calco()
GA = LF-LE
IF Locato1 = Locato2
DX := 1
Else
N=SIN(BE)*SIN(BF)+COS(BE)*COS(BF)*COS(GA) && calcolo qrb
DX=INT(( - ATn(N/SQRT(1-N*N))+3.1415926/2)*F+.5)
Endif

RETURN Nil
*-----------------

FUNC Calco

oa=ASC(Substr(locato,1,1))
ob=ASC(Substr(locato,2,1))
oc=Substr(locato,3,1)
od=Substr(locato,4,1)
oe=ASC(Substr(locato,5,1))
of=ASC(Substr(locato,6,1))
LF=(oa-65)*20-180 +VAL(oc)*2 +(oe-65)/12+1/24
BF=(ob-65)*10-90 +VAL(od) + (of-65)/24+1/48
LF=LF * P
BF=BF * P

RETURN NIL

Re: Problema GPF

Posted: Sat Feb 07, 2009 6:51 pm
by Antonio Linares
Si quitas esta linea:

ON CHANGE E_Loca(oDlg);

ya no hay GPF ?

Re: Problema GPF

Posted: Sat Feb 07, 2009 6:55 pm
by ik1mtt
Si quito ON CHANGE E_Loca(oDlg,;
no tengo PGF,
tambièn si cambio ON CHANGE con ON CLICK
no tengo problema....

Re: Problema GPF

Posted: Sat Feb 07, 2009 10:17 pm
by Antonio Linares
Try to just change the text from the ON CHANGE:

ON CHANGE If( oSay != nil, oSay:SetText( "Qrb Km:"+Qrb ),) ;

and create the SAY object in the same place where you create the browse.

Re: Problema GPF

Posted: Sun Feb 08, 2009 11:51 am
by ik1mtt
Ciao Antonio.

Solucionado el problema.

¡Muchas gracias!

Re: Problema GPF

Posted: Sun Feb 08, 2009 12:10 pm
by Antonio Linares
Molto bene! :-)

Re: Problema GPF

Posted: Mon Feb 09, 2009 11:33 am
by Biel EA6DD
Cia Marco de EA6DD Biel. 73