FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour xbrowse : bchange is executed twice in lButtondown
Posts: 167
Joined: Thu Mar 22, 2007 11:24 AM
xbrowse : bchange is executed twice in lButtondown
Posted: Tue Sep 30, 2008 10:36 AM

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 ????

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
xbrowse : bchange is executed twice in lButtondown
Posted: Wed Oct 01, 2008 08:05 AM

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
Posts: 167
Joined: Thu Mar 22, 2007 11:24 AM
xbrowse : bchange is executed twice in lButtondown
Posted: Wed Oct 01, 2008 12:31 PM
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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
xbrowse : bchange is executed twice in lButtondown
Posted: Wed Oct 01, 2008 01:11 PM
Will this be okay?
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
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
xbrowse : bchange is executed twice in lButtondown
Posted: Wed Oct 01, 2008 01:23 PM

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

Continue the discussion