FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour XBrowse. Bug in row painting
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

XBrowse. Bug in row painting

Posted: Mon Jan 14, 2008 04:30 PM
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
Posts: 252
Joined: Tue Oct 25, 2005 02:48 PM

XBrowse. Bug in row painting

Posted: Tue Jan 15, 2008 01:03 PM

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

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

XBrowse. Bug in row painting

Posted: Tue Jan 15, 2008 04:05 PM
Here is a reproduction of the problem faced by Mr. Maurilio, also by our users at times.
#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.
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

XBrowse. Bug in row painting

Posted: Tue Jan 15, 2008 04:29 PM
Here is the fix for this problem:
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
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

XBrowse. Bug in row painting

Posted: Sun Feb 10, 2008 08:40 PM

Nageswararao,

Included, many thanks!

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion