Page 2 of 2
Posted: Mon Jan 14, 2008 4:30 pm
by nageswaragunupudi
Mr Maurilio
I will test insert SysRefresh in that method and try. Any news I post here!
Please insert SysRefresh() before the first DrawLine() statement. If it works let it work till Mr Antonio provides us with the correct solution.
Meanwhile, can you please let us know under what circumsances are you getting this problem? I would like to recreate under what all circumstances this problem happens. That might help us to localize the problem.
Posted: Tue Jan 15, 2008 1:03 pm
by Maurilio Viana
Hello!
I have this problem using arrays, I use SQLRDD and all my xBrowses is based on arrays. When I use the sequence Page Up/Page Down/Up key/Down key (I don't get yet the correct sequence) first line is displayed in wrong place (like posted picture in firts posts from this topic).
I'm trying use SysRefresh like said and I think is working fine... I'll do a lot of tests emulating real circumstances. Any news I post here!
Best regards,
Maurilio
Posted: Tue Jan 15, 2008 4:05 pm
by nageswaragunupudi
Here is a reproduction of the problem faced by Mr. Maurilio, also by our users at times.
Code: Select all | Expand
#include 'fivewin.ch'
#include 'xbrowse.ch'
function main()
local ownd, obrw, ocol, adata := {}, n
for n := 1 to 50
aadd( adata, { str(n,3), replicate( chr(64+n), 20 ) } )
next n
define window ownd
obrw := txbrowse():new( ownd )
obrw:setarray( adata )
obrw:acols[1]:cheader := 'No'
obrw:acols[2]:cheader := 'details'
obrw:createfromcode()
ownd:oclient := obrw
activate window ownd
return nil
The problem occurs when the total number of rows is not a multiple of the data rows of the browse. if not adjust the size of window so that the number of total rows is not a multiple of datarows.
Go bottom with CtrlEnd or CtrlPgDn. Keep pressing PgUp till the row number is less than the number of data rows. Now we see the problem.
Here is the screen shot.
Posted: Tue Jan 15, 2008 4:29 pm
by nageswaragunupudi
Here is the fix for this problem:
Code: Select all | Expand
METHOD PageUp( nLines ) CLASS TXBrowse
local nSkipped
if ::nLen < 1
return nil
endif
DEFAULT nLines := ::RowCount()
::CancelEdit()
::Seek()
::DrawLine()
nSkipped = Eval( ::bSkip, -nLines )
if nSkipped = 0
::DrawLine(.t.)
return nil
endif
if -nSkipped < nLines
::nRowSel = 1
if ::bChange != nil
Eval( ::bChange, Self )
endif
// ::lRefreshOnlyData := .t.
::Super:Refresh( .f. )
if ::oVScroll != nil
::VGoTop()
endif
else
// FIX : Insert the following three lines
if eval( ::bkeyno ) < ::nRowSel // fix
eval( ::bKeyNo, ::nRowSel ) // fix
endif // fix
// FIX : END
if ::bChange != nil
Eval( ::bChange, Self )
endif
// ::lRefreshOnlyData := .t.
::Super:Refresh( .f. )
if ::oVScroll != nil
::VSetPos( ::VGetPos() + nSkipped )
endif
endif
return nil
Mr. Maurilio
Please apply this fix and see if your problem is solved. I am sure it does. Please confirm
Mr. Antonio
If you examine and approve the fix we shall incorporate this.
Posted: Sun Feb 10, 2008 8:40 pm
by Antonio Linares
Nageswararao,
Included, many thanks!