TWbrowse and ordscope function

TWbrowse and ordscope function

Postby pawelu » Tue Jun 13, 2006 12:32 pm

Antonio,

I create TWbrowse control based on database with ordscope function (sample below). TWbrose have about 7 row, filtered database - 3. When user move vertical scrollbar at the end of scale current record is diplayed standalone at the end of control. How to filter database properly with ordscope function ?

Regards
Pawel

Code: Select all  Expand view  RUN
Function Brw ()

   Local oWnd := Nil
   Local oBrw := Nil
   Local aStr := {}

   InitEnv ()

   FErase ('Brw' + IndexExt ())
   AAdd (aStr, {'F1', 'C', 10, 0})
   AAdd (aStr, {'F2', 'N',  5, 0})
   DbCreate ('Brw', aStr)
   Use Brw New
   Index On Brw->F1 Tag Brw To Brw

   For i := 1 To 100
       Brw->(DbAppend ())
       If i % 31 == 0
          Brw->F1 := 'A' + PadL (i, 3, '0')
       Else
          Brw->F1 := 'B' + PadL (i, 3, '0')
       Endif 
       Brw->F2 := i
   Next   
   Brw->(DbGoTop ())
   Brw->(OrdScope (0, 'A'))
   Brw->(OrdScope (1, 'A'))
   Brw->(DbSeek ('A'))

   Define Window oWnd Title 'Test'
   @  39,  0 ListBox oBrw ;
   Fields ;
   Brw->F1, ;
   TransForm (Brw->F2, '999') ;
   Alias 'Brw' ;
   FieldSizes 100, 100 ;
   Header 'F1', 'F2' ;
   Size 240, 148 ;
   Pixel
   Activate Window oWnd

   Brw->(DbCloseArea ())
   FErase ('Brw' + IndexExt ())

Return .T.

Function InitEnv ()

   Request DbfCdx
   Request DbfFpt
   RddSetDefault ('DbfCdx')
   Request Hb_Lang_PL852
   Request Hb_Lang_PLWIN
   Request Hb_CodePage_PL852
   Request Hb_CodePage_PLWIN

   Set Century On
   Set Epoch To 1995
   Set Date German
   Set Deleted On
   Hb_LangSelect ('PL')
   Hb_SetCodePage ('PLWIN')

Return .T.


Image
pawelu
 
Posts: 126
Joined: Thu Oct 06, 2005 10:18 pm
Location: Poland

Postby Antonio Linares » Tue Jun 13, 2006 9:10 pm

Pawel,

You need to properly set <oBrowse>:bLogicLen DATA so the browse knows how many records is managing:

oBrw:bLogicLen = { || Brw->( OrdKeyCount() ) }
regards, saludos

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


Return to FiveWin for Pocket PC

Who is online

Users browsing this forum: No registered users and 5 guests