XBrowse. Bug in row painting

User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post 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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
Maurilio Viana
Posts: 252
Joined: Tue Oct 25, 2005 2:48 pm
Location: Garça/Garza/Heron City - Brazil
Contact:

Post 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
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

Here is a reproduction of the problem faced by Mr. Maurilio, also by our users at times.

Code: Select all

#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.
Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

Here is the fix for this problem:

Code: Select all

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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Nageswararao,

Included, many thanks!
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply