Enrico,
Fixed. This code seems the right one:
Code: Select all
METHOD ReSize( nSizeType, nWidth, nHeight ) CLASS TWBrowse
local n, nTotalSize := 0, aSizes := ::GetColSizes()
::nRowPos = Min( ::nRowPos, Max( ::nRowCount(), 1 ) )
n = Max( ::nColPos, 1 )
while nTotalSize < nWidth .and. n <= Len( aSizes )
nTotalSize += aSizes[ n++ ]
end
::nColAct = Min( --n, ::nColAct )
if ::oHScroll != nil
::oHScroll:SetPos( ::nColAct )
endif
return Super:ReSize( nSizeType, nWidth, nHeight )
Please modify your example as follows and shrink the window and you will see how the selected cell is changed to the last visible one:
Code: Select all
#include "Fivewin.ch"
FUNCTION MAIN()
LOCAL oWnd, oBrw
DBCREATE( "BUGTEST", { { "TEST1", "C", 10, 0 },;
{ "TEST2", "C", 10, 0 },;
{ "TEST3", "C", 10, 0 },;
{ "TEST4", "C", 10, 0 } } )
USE BUGTEST
APPEND BLANK
DEFINE WINDOW oWnd
@ 0, 0 LISTBOX oBrw FIELDS
oBrw:lCellStyle = .T.
oWnd:oClient = oBrw
ACTIVATE WINDOW oWnd
CLOSE
RETURN NIL