TxBrowse() - Vertical scrollbar with filtered data

TxBrowse() - Vertical scrollbar with filtered data

Postby Davide » Sun Feb 18, 2007 12:55 pm

Hello all,

I've noticed that in the vertical scrollbar the arrows are working ok, while by directly moving the square, sometimes filtered data reappears in the browse (sometimes even deleted records)

oBrw:KeyCount() returns a number including also the filtered records.
Maybe I should specify a scope for the browse instead of using SET FILTER TO externally ? - If so, how ?

TIA
Davide
FWH 27-3 - xH 0.99.60

Code: Select all  Expand view  RUN
// Database already opened, SET DELETED ON, filtered data with SET FILTER

   oBrw := TXBrowse():New( oWnd )

   oBrw:nMarqueeStyle       := MARQSTYLE_HIGHLROW
   oBrw:nColDividerStyle    := LINESTYLE_BLACK
   oBrw:nRowDividerStyle    := LINESTYLE_BLACK

   oBrw:SetRDD()

   For i:=1 to 3
     oBrw:aCols[ i ]:blDClickData := {|r,c,f,o| MyFunc(.f.) }
   Next i

   oBrw:lVScroll:=.f.    // workaround

   oBrw:CreateFromCode()
   oWnd:oClient := oBrw
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Postby R.F. » Sun Feb 18, 2007 4:28 pm

I dont use xBrowse, but in the other browses, all of them have a DATA called bLogicLen which is used to draw the thumb position in the vertical scroll bar.

the data is normally asigned to a codebloc containing {|| lastrec()} so in order to get the correct placement of the thumb you must asign this data to a value that reflects the real size of the databas, for example to the OrdKeyCount() function
Saludos
R.F.
R.F.
 
Posts: 840
Joined: Thu Oct 13, 2005 7:05 pm

Postby Davide » Sun Feb 18, 2007 4:53 pm

Dear Rene,

thank you for your reply.
RF wrote:I dont use xBrowse, but in the other browses, all of them have a DATA called bLogicLen which is used to draw the thumb position in the vertical scroll bar.

Yes, it's called bKeyNo in xBrowse.
Anyway, the thumb is drawn correctly, and the browse normally works correctly.
It's only if I MOVE the thumb myself that I start seeing strange things in the browse.
As KeyCount() returns a number including also the filtered and deleted records I though that perhaps I should have assigned a "filter data" codeblock to the browse itself somehow.
Any idea ?
Thanks,
Davide.
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Postby James Bott » Sun Feb 18, 2007 7:39 pm

Davide,

If you are using an index you should build the index with the FOR ! DELETED() clause. I build all my indexes like that. This way deleted recrods will not be included in ordKeyCount().

Filters are another matter. When an index is built using the above clause it, of course, has to read the entire database. If you set a filter at runtime, there is no way to know how many records are going to be in the filter without reading the entire database. So, there is no way to get a proper count for use by the thumbbar.

The only other soultion is to use indexes (with the FOR ! DELETED() clause) and to set a scope. This way ordKeyCount() knows the number of records in the scope without rereading the entire database.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Davide » Mon Feb 19, 2007 2:56 pm

James,

thank you for your reply.
James Bott wrote:The only other soultion is to use indexes (with the FOR ! DELETED() clause) and to set a scope. This way ordKeyCount() knows the number of records in the scope without rereading the entire database.

That DBF contains only a few records and does not have any index.
I'm not sure I've correctly understood the "scope" part of your reply.
How could I apply such scope to my DBF/xBrowse ?

TIA,
Davide
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Postby James Bott » Mon Feb 19, 2007 3:25 pm

Davide,

>That DBF contains only a few records and does not have any index.

If that is the case it is possible and feasible to count all the records in the filter and change bKeyCount to return the total.

>I'm not sure I've correctly understood the "scope" part of your reply.
How could I apply such scope to my DBF/xBrowse ?

You use an index to create the scope of the view of records. For example you could index on CUSTNO and then set the scope to only view one CUSTNO.

Code: Select all  Expand view  RUN
index on custno to custno for ! deleted()

   ordScope(0, cCustno) // set the bottom scope
   ordScope(1, cCustno) // set the top scope


james
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Davide » Mon Feb 19, 2007 4:01 pm

James,
James Bott wrote:If that is the case it is possible and feasible to count all the records in the filter and change bKeyCount to return the total.

this cured the problem.
Thank you,
Davide
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 35 guests