xbrowse : bchange is executed twice in lButtondown

Post Reply
demont frank
Posts: 167
Joined: Thu Mar 22, 2007 11:24 am

xbrowse : bchange is executed twice in lButtondown

Post by demont frank »

Hello,

I have a problem with wbrose , using bChange

In this version bChange is executed twice , after linking in i can see that bChange is executed in lButtondown

1) on line 2645

if nRowPos > 0
::Skip( nRowPos - ::nRowSel ) // Eval( ::bSkip, nRowPos - ::nRowSel )
::nRowSel := nRowPos
::Change( .t. ) <----------- 2645
endif

2) on line 2669


This error was already present in 8.01. Looking in the source i can see the changes i made already (but was forgotten)

I introduced a local var

# ifdef FRANKDEMONT
local lChangExecuted := .F.
# endif

Which is changed when bChange is executed (line 2646)

The ::change(.T.) on line 2669 is only executed when lChangeExecuted is .F.

Maybe there is a better solution ????
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Frank,

It is simpler if we remove the call to ::Change( .t. ) from line 2669 as it is already called from line 2645.

Thanks for your feedback! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
demont frank
Posts: 167
Joined: Thu Mar 22, 2007 11:24 am

Post by demont frank »

Antonio Linares wrote:Frank,

It is simpler if we remove the call to ::Change( .t. ) from line 2669 as it is already called from line 2645.

Thanks for your feedback! :-)
What if NOT nRowpos > 0 ? Change() would not be executed !

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

Post by nageswaragunupudi »

Will this be okay?

Code: Select all

if nRowPos > 0 .and. nRowPos != ::nRowSel
   ::Skip( nRowPos - ::nRowSel )
   ::nRowSel := nRowPos
   if nColPos > 0
      ::nColSel   := nColPos
   endif
   ::Change( .t. )
else
   if nColPos > 0 .and. nColPos != ::nColSel
      ::nColSel   := nColPos
      ::Change( .f. )
   endif
endif
And remove the ::Change( .t. ) at the end ( just before oVSroll present line 2669 )
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 »

nRowPos is only zero for the header, and the header will not change for skipping records.

So IMO it is fine if we simply remove the extra call to ::Change(). Unless I am missing something :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply