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
In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
TBrowse problem
-
- Mensajes: 281
- Registrado: Vie Ago 04, 2006 4:58 pm