Hi Antonio
I have a situation where wbrowse.prg method nRowCount is returning 53000 rows! This causes one of my browses on a dbf (which has +- 160,000 records in it) to take ages to open.
nRowCount calls nwrows which calls GetWindowRows (extracted below)
nRowCount should obviously never return more than the no of rows a browse could theoretically display with its font - say 100
It only happens on the 1st call to nRowCount (in our case from upstable), which causes UpStable to skip through 53000 records. Thereafter it returns the correct no of rows (39)
The font object in Wbrowse has a valid handle and seems fine.
Can you comment on what might be causing this ?
Thanks
Peter
*********************************
WORD GetWindowRows( HWND hWnd, HDC hDC, HFONT hFont )
{
TEXTMETRIC tm;
RECT rct;
WORD wRows;
BOOL bDCDestroy = FALSE;
HFONT hOldFont;
if( ! hDC )
{
bDCDestroy = TRUE;
hDC = GetDC( hWnd );
}
if( hFont )
hOldFont = ( HFONT ) SelectObject( hDC, hFont );
GetTextMetrics( hDC, &tm );
tm.tmHeight += 1;
GetClientRect( hWnd, &rct );
wRows = ( rct.bottom - rct.top ) / tm.tmHeight;
if( hFont )
SelectObject( hDC, hOldFont );
if( bDCDestroy )
ReleaseDC( hWnd, hDC );
return wRows;
}
//----------------------------------------------------------------------------//
CLIPPER NWROWS( PARAMS ) // hWnd, hDC, hFont
{
_retni( GetWindowRows( ( HWND ) _parnl( 1 ), ( HDC ) _parnl( 2 ),
( HFONT ) _parnl( 3 ) ) );
}