Página 1 de 1

TBrowse problem

Publicado: Lun Ago 07, 2006 4:37 pm
por Giuseppe Bogetti
Hi,
I'm trying to use the basic TBrowse object but I cannot make it work.
Here is the code I use.
//---------------------------------------------------------- --------------------
METHOD FormInitialize( oSender ) CLASS TForm1
// Apertura tabella
USE "W:Nova6Artico.dbf" ALIAS artico
artico->( OrdSetFocus( 1 ) )
// Creazione browser
WITH OBJECT ::oBrw := TBrowse():New( ::oDbPanel )
:nAlign := alCLIENT
WITH OBJECT TBrwColumn():New( hb_QWith() )
:cHeader := "Codice"
:OnGetData := {|o| artico->( FieldGet( 3 ) ) }
:Create()
END WITH
WITH OBJECT TBrwColumn():New( hb_QWith() )
:cHeader := "Descrizione"
:OnGetData := {|o| RTrim( artico->( FieldGet( 4 ) ) ) + " " +
;
RTrim( artico->( FieldGet( 5 ) ) ) }
:Create()
END WITH
// Creazione browser
:Create()
// Inizializzazione eventi
:OnGoTop := {|o| artico->( dbGoTop() ) }
:OnGoBottom := {|o| artico->( dbGoBottom() ) }
:OnSkip := {|o,n| ::Skipper( o, n ) }
:OnBof := {|o| artico->( Bof() ) }
:OnEof := {|o| artico->( Eof() ) }
:OnBookMark := {|o, n| iif( n == nil, artico->( RecNo() ), artico->(
dbGoTo( n ) ) ) }
:OnKeyNo := {|o, n| iif( n == nil, artico->( RecNo() ), artico->(
dbGoTo( n ) ) ) }
:OnKeyCount := {|o| artico->( LastRec() ) }
// Visualizzazione tabella
AltD()
:Refresh( .t. )
END WITH
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD Skipper( oSender, n2Skip ) CLASS TForm1
LOCAL nSkipped AS NUMERIC := 0
IF ( n2Skip == Nil )
n2Skip := 1
ENDIF
WHILE ( nSkipped # n2skip )
IF ( n2skip > 0 )
// FORWARD
artico->( DbSkip( 1 ) )
IF ( artico->( Eof() ) )
artico->( DbSkip( -1 ) )
EXIT
ELSE
nSkipped++
ENDIF
ELSE
// BACKWARD
artico->( DbSkip( -1 ) )
IF ( artico->( Bof() ) )
EXIT
ELSE
nSkipped--
ENDIF
ENDIF
ENDDO
RETURN nSkipped
When I execute the form in debug mode, I've noticed that the OnSkip event
is never fired and the browse displays the content of the first record of
the table in every row.
When all the rows are filled it gives the following error:
Chiamata a sottosistema: BASE
Codice di sistema: 1081
Stato di default: .F.
Descrizione: Argument error
Operazione: +
Argomenti: [ 1] = Tipo: N Val: 7639 [ 2] = Tipo: U Val: NIL
File coinvolti:
Codice di errore Dos: 0
Chiamato da:
TBROWSE:WMPAINT (157)
UPDATEWINDOW (0)
(b)XCONTROL:XCONTROL (90)
TFORM1:UPDATE (0)
TFORM1:WMNCACTIVATE (729)
SHOWWINDOW (0)
TSCROLLINGWINCONTROL:SHOW (582)
TFORM1:SHOW (430)
MAIN (19)
Can someone please explain what am I doing wrong ?
--
Best regards,
Giuseppe Bogetti
B.G. Soft
Cuneo - Italy

TBrowse problem

Publicado: Mar Ago 08, 2006 11:41 am
por _support_
Giuseppe,
Without a small sample is difficult to help you. BTW all the On???? events
should return 0 in order to avoid default execution.
Regards,
"Giuseppe Bogetti" <orangeREMOVEMEsocks@bgsoft.it> escribió en el mensaje
news:cozh6ia6fpop$.oep3dh532abj$[email=.dlg@40tude.net...].dlg@40tude.net...[/email]
> Hi,
>
> I'm trying to use the basic TBrowse object but I cannot make it work.
> Here is the code I use.
>
> //---------------------------------------------------------- --------------------
> METHOD FormInitialize( oSender ) CLASS TForm1
>
> // Apertura tabella
> USE "W:Nova6Artico.dbf" ALIAS artico
> artico->( OrdSetFocus( 1 ) )
> // Creazione browser
> WITH OBJECT ::oBrw := TBrowse():New( ::oDbPanel )
> :nAlign := alCLIENT
> WITH OBJECT TBrwColumn():New( hb_QWith() )
> :cHeader := "Codice"
> :OnGetData := {|o| artico->( FieldGet( 3 ) ) }
> :Create()
> END WITH
> WITH OBJECT TBrwColumn():New( hb_QWith() )
> :cHeader := "Descrizione"
> :OnGetData := {|o| RTrim( artico->( FieldGet( 4 ) ) ) + " " +
> ;
> RTrim( artico->( FieldGet( 5 ) ) ) }
> :Create()
> END WITH
> // Creazione browser
> :Create()
> // Inizializzazione eventi
> :OnGoTop := {|o| artico->( dbGoTop() ) }
> :OnGoBottom := {|o| artico->( dbGoBottom() ) }
> :OnSkip := {|o,n| ::Skipper( o, n ) }
> :OnBof := {|o| artico->( Bof() ) }
> :OnEof := {|o| artico->( Eof() ) }
> :OnBookMark := {|o, n| iif( n == nil, artico->( RecNo() ), artico->(
> dbGoTo( n ) ) ) }
> :OnKeyNo := {|o, n| iif( n == nil, artico->( RecNo() ), artico->(
> dbGoTo( n ) ) ) }
> :OnKeyCount := {|o| artico->( LastRec() ) }
> // Visualizzazione tabella
> AltD()
> :Refresh( .t. )
> END WITH
>
> RETURN Nil
>
> //---------------------------------------------------------- --------------------
> METHOD Skipper( oSender, n2Skip ) CLASS TForm1
> LOCAL nSkipped AS NUMERIC := 0
>
> IF ( n2Skip == Nil )
> n2Skip := 1
> ENDIF
>
> WHILE ( nSkipped # n2skip )
> IF ( n2skip > 0 )
> // FORWARD
> artico->( DbSkip( 1 ) )
> IF ( artico->( Eof() ) )
> artico->( DbSkip( -1 ) )
> EXIT
> ELSE
> nSkipped++
> ENDIF
> ELSE
> // BACKWARD
> artico->( DbSkip( -1 ) )
> IF ( artico->( Bof() ) )
> EXIT
> ELSE
> nSkipped--
> ENDIF
> ENDIF
> ENDDO
>
> RETURN nSkipped
>
> When I execute the form in debug mode, I've noticed that the OnSkip event
> is never fired and the browse displays the content of the first record of
> the table in every row.
>
> When all the rows are filled it gives the following error:
>
> Chiamata a sottosistema: BASE
> Codice di sistema: 1081
> Stato di default: .F.
> Descrizione: Argument error
> Operazione: +
> Argomenti: [ 1] = Tipo: N Val: 7639 [ 2] = Tipo: U Val: NIL
> File coinvolti:
> Codice di errore Dos: 0
>
> Chiamato da:
> TBROWSE:WMPAINT (157)
> UPDATEWINDOW (0)
> (b)XCONTROL:XCONTROL (90)
> TFORM1:UPDATE (0)
> TFORM1:WMNCACTIVATE (729)
> SHOWWINDOW (0)
> TSCROLLINGWINCONTROL:SHOW (582)
> TFORM1:SHOW (430)
> MAIN (19)
>
> Can someone please explain what am I doing wrong ?
>
> --
> Best regards,
>
> Giuseppe Bogetti
> B.G. Soft
> Cuneo - Italy

TBrowse problem

Publicado: Mar Ago 08, 2006 11:41 am
por _support_
Giuseppe,
Without a small sample is difficult to help you. BTW all the On???? events
should return 0 in order to avoid default execution.
Regards,
"Giuseppe Bogetti" <orangeREMOVEMEsocks@bgsoft.it> escribió en el mensaje
news:cozh6ia6fpop$.oep3dh532abj$[email=.dlg@40tude.net...].dlg@40tude.net...[/email]
> Hi,
>
> I'm trying to use the basic TBrowse object but I cannot make it work.
> Here is the code I use.
>
> //---------------------------------------------------------- --------------------
> METHOD FormInitialize( oSender ) CLASS TForm1
>
> // Apertura tabella
> USE "W:Nova6Artico.dbf" ALIAS artico
> artico->( OrdSetFocus( 1 ) )
> // Creazione browser
> WITH OBJECT ::oBrw := TBrowse():New( ::oDbPanel )
> :nAlign := alCLIENT
> WITH OBJECT TBrwColumn():New( hb_QWith() )
> :cHeader := "Codice"
> :OnGetData := {|o| artico->( FieldGet( 3 ) ) }
> :Create()
> END WITH
> WITH OBJECT TBrwColumn():New( hb_QWith() )
> :cHeader := "Descrizione"
> :OnGetData := {|o| RTrim( artico->( FieldGet( 4 ) ) ) + " " +
> ;
> RTrim( artico->( FieldGet( 5 ) ) ) }
> :Create()
> END WITH
> // Creazione browser
> :Create()
> // Inizializzazione eventi
> :OnGoTop := {|o| artico->( dbGoTop() ) }
> :OnGoBottom := {|o| artico->( dbGoBottom() ) }
> :OnSkip := {|o,n| ::Skipper( o, n ) }
> :OnBof := {|o| artico->( Bof() ) }
> :OnEof := {|o| artico->( Eof() ) }
> :OnBookMark := {|o, n| iif( n == nil, artico->( RecNo() ), artico->(
> dbGoTo( n ) ) ) }
> :OnKeyNo := {|o, n| iif( n == nil, artico->( RecNo() ), artico->(
> dbGoTo( n ) ) ) }
> :OnKeyCount := {|o| artico->( LastRec() ) }
> // Visualizzazione tabella
> AltD()
> :Refresh( .t. )
> END WITH
>
> RETURN Nil
>
> //---------------------------------------------------------- --------------------
> METHOD Skipper( oSender, n2Skip ) CLASS TForm1
> LOCAL nSkipped AS NUMERIC := 0
>
> IF ( n2Skip == Nil )
> n2Skip := 1
> ENDIF
>
> WHILE ( nSkipped # n2skip )
> IF ( n2skip > 0 )
> // FORWARD
> artico->( DbSkip( 1 ) )
> IF ( artico->( Eof() ) )
> artico->( DbSkip( -1 ) )
> EXIT
> ELSE
> nSkipped++
> ENDIF
> ELSE
> // BACKWARD
> artico->( DbSkip( -1 ) )
> IF ( artico->( Bof() ) )
> EXIT
> ELSE
> nSkipped--
> ENDIF
> ENDIF
> ENDDO
>
> RETURN nSkipped
>
> When I execute the form in debug mode, I've noticed that the OnSkip event
> is never fired and the browse displays the content of the first record of
> the table in every row.
>
> When all the rows are filled it gives the following error:
>
> Chiamata a sottosistema: BASE
> Codice di sistema: 1081
> Stato di default: .F.
> Descrizione: Argument error
> Operazione: +
> Argomenti: [ 1] = Tipo: N Val: 7639 [ 2] = Tipo: U Val: NIL
> File coinvolti:
> Codice di errore Dos: 0
>
> Chiamato da:
> TBROWSE:WMPAINT (157)
> UPDATEWINDOW (0)
> (b)XCONTROL:XCONTROL (90)
> TFORM1:UPDATE (0)
> TFORM1:WMNCACTIVATE (729)
> SHOWWINDOW (0)
> TSCROLLINGWINCONTROL:SHOW (582)
> TFORM1:SHOW (430)
> MAIN (19)
>
> Can someone please explain what am I doing wrong ?
>
> --
> Best regards,
>
> Giuseppe Bogetti
> B.G. Soft
> Cuneo - Italy

TBrowse problem

Publicado: Mar Ago 08, 2006 6:09 pm
por Giuseppe Bogetti
Il Tue, 8 Aug 2006 11:41:55 +0200, Ignacio Ortiz de Zúñiga ha scritto:
Ignacio,
> Without a small sample is difficult to help you. BTW all the On???? events
> should return 0 in order to avoid default execution.
>
Attacched is a self contained project.
Thanks for your help.
--
Best regards,
Giuseppe Bogetti
B.G. Soft
Cuneo - Italy
--

TBrowse problem

Publicado: Mar Ago 08, 2006 6:09 pm
por Giuseppe Bogetti
Il Tue, 8 Aug 2006 11:41:55 +0200, Ignacio Ortiz de Zúñiga ha scritto:
Ignacio,
> Without a small sample is difficult to help you. BTW all the On???? events
> should return 0 in order to avoid default execution.
>
Attacched is a self contained project.
Thanks for your help.
--
Best regards,
Giuseppe Bogetti
B.G. Soft
Cuneo - Italy
--

TBrowse problem

Publicado: Mié Ago 09, 2006 12:26 pm
por _support_
Giuseppe,
You can not use TBrowse directly. I attach with this message the corrected
code.
Regards,
"Giuseppe Bogetti" <orangeREMOVEMEsocks@bgsoft.it> escribió en el mensaje
news:1exsv55gb51vq$[email=.hss8ukr4cw66.dlg@40tude.net...].hss8ukr4cw66.dlg@40tude.net...[/email]
> Il Tue, 8 Aug 2006 11:41:55 +0200, Ignacio Ortiz de Zúñiga ha scritto:
>
> Ignacio,
>> Without a small sample is difficult to help you. BTW all the On????
>> events
>> should return 0 in order to avoid default execution.
>>
> Attacched is a self contained project.
>
> Thanks for your help.
>
> --
> Best regards,
>
> Giuseppe Bogetti
> B.G. Soft
> Cuneo - Italy


Attached files TestBrowse.zip (2.2 KB)Â

TBrowse problem

Publicado: Mié Ago 09, 2006 12:26 pm
por _support_
Giuseppe,
You can not use TBrowse directly. I attach with this message the corrected
code.
Regards,
"Giuseppe Bogetti" <orangeREMOVEMEsocks@bgsoft.it> escribió en el mensaje
news:1exsv55gb51vq$[email=.hss8ukr4cw66.dlg@40tude.net...].hss8ukr4cw66.dlg@40tude.net...[/email]
> Il Tue, 8 Aug 2006 11:41:55 +0200, Ignacio Ortiz de Zúñiga ha scritto:
>
> Ignacio,
>> Without a small sample is difficult to help you. BTW all the On????
>> events
>> should return 0 in order to avoid default execution.
>>
> Attacched is a self contained project.
>
> Thanks for your help.
>
> --
> Best regards,
>
> Giuseppe Bogetti
> B.G. Soft
> Cuneo - Italy


Attached files TestBrowse.zip (2.2 KB)Â

TBrowse problem

Publicado: Mié Ago 09, 2006 8:05 pm
por Giuseppe Bogetti
Il Wed, 9 Aug 2006 12:26:03 +0200, Ignacio Ortiz de Zúñiga ha scritto:
Ignacio,
> You can not use TBrowse directly. I attach with this message the corrected
> code.
Thanks for the reply.
--
Best regards,
Giuseppe Bogetti
B.G. Soft
Cuneo - Italy

TBrowse problem

Publicado: Mié Ago 09, 2006 8:05 pm
por Giuseppe Bogetti
Il Wed, 9 Aug 2006 12:26:03 +0200, Ignacio Ortiz de Zúñiga ha scritto:
Ignacio,
> You can not use TBrowse directly. I attach with this message the corrected
> code.
Thanks for the reply.
--
Best regards,
Giuseppe Bogetti
B.G. Soft
Cuneo - Italy