Page 1 of 1

xBrowse - incremental search

Posted: Mon Nov 12, 2007 7:37 am
by Otto
If I search and the find position is not on the first page I lose the header and the row pointer.

Image
Image

Posted: Mon Nov 12, 2007 8:28 am
by Biel EA6DD
Search the string ::lRefreshOnlyData := .T. (2 times) in the method Seek of txBrowse, coment it.

Posted: Mon Nov 12, 2007 8:33 am
by Otto
Thank you.
I have verion 07.11 and I can't find lRefreshOnlyData 2 times in the methode.
Regards,
Otto

METHOD Seek( cSeek ) CLASS TXBrowse

local uBook, uSeek
local nFor, nRows
local lRefresh

if ::bSeek == nil
return nil
endif

If cSeek == nil
if !Empty(::cSeek)
::cSeek := ""
If ::oSeek != nil
::oSeek:SetText("")
Endif
endif
return nil
Endif

uBook := Eval( ::bBookMark )

if !Eval( ::bSeek, cSeek )
Eval( ::bBookMark, uBook )
MsgBeep()
return nil
endif

if ::nRowSel > Eval( ::bKeyNo )
::nRowsel := 1
else
::lRefreshOnlyData := .t.
endif

::cSeek := cSeek
uSeek := Eval( ::bBookMark )
nRows := ::nDataRows
lRefresh := .t.

if ::oSeek != nil
::oSeek:SetText( cSeek )
endif

Eval( ::bBookMark, uBook )
Eval( ::bSkip, 1 - ::nRowSel )

for nFor := 1 to nRows
if Eval( ::bBookMark ) == uSeek
lRefresh := .f.
exit
endif
if Eval( ::bSkip, 1) == 0
exit
endif
next

if lRefresh
Eval( ::bBookMark, uSeek )
if ::bChange != nil
Eval( ::bChange, Self )
endif
// ::lRefreshOnlyData := .t.
::Super:Refresh(.f.)
else
Eval( ::bBookMark, uBook )
::DrawLine( .f. )
::nRowSel := nFor
Eval( ::bBookMark, uSeek )
if ::bChange != nil
Eval( ::bChange, Self )
endif
::DrawLine( .t. )
endif

if ::oVScroll != nil
::VSetPos( Eval( ::bKeyNo,,Self ) )
endif

return nil

Posted: Mon Nov 12, 2007 8:39 am
by Antonio Linares
Otto,

Use this code:

Code: Select all

METHOD Seek( cSeek ) CLASS TXBrowse

   local uBook, uSeek
   local nFor, nRows
   local lRefresh

   if ::bSeek == nil
      return nil
   endif

   If cSeek == nil
      if ! Empty( ::cSeek )
         ::cSeek := ""
         If ::oSeek != nil
            ::oSeek:SetText( "" )
         Endif
      endif
      return nil
   Endif

   uBook := Eval( ::bBookMark )

   if !Eval( ::bSeek, cSeek )
      Eval( ::bBookMark, uBook )
      MsgBeep()
      return nil
   endif

   if ::nRowSel > Eval( ::bKeyNo,, Self )
      ::nRowsel := 1              
   endif                          

   ::cSeek  := cSeek
   uSeek    := Eval( ::bBookMark )
   nRows    := ::nDataRows
   lRefresh := .t.

   if ::oSeek != nil
      ::oSeek:SetText( cSeek )
   endif

   Eval( ::bBookMark, uBook )
   Eval( ::bSkip, 1 - ::nRowSel )

   for nFor := 1 to nRows
      if Eval( ::bBookMark ) == uSeek
         lRefresh := .f.
         exit
      endif
      if Eval( ::bSkip, 1 ) == 0
         exit
      endif
   next

   if lRefresh
      Eval( ::bBookMark, uSeek )
   	  if ::bChange != nil
   	     Eval( ::bChange, Self )
   	  endif
   	  ::Super:Refresh( .F. )
   else
      Eval( ::bBookMark, uBook )
      ::DrawLine( .f. )
      ::nRowSel := nFor
      Eval( ::bBookMark, uSeek )
     	if ::bChange != nil
   	     Eval( ::bChange, Self )
   	  endif
      ::DrawLine( .t. )
   endif

   if ::oVScroll != nil
      ::VSetPos( Eval( ::bKeyNo,,Self ) )
   endif

return nil

Posted: Mon Nov 12, 2007 8:41 am
by Biel EA6DD
Otto wrote:Thank you.
I have verion 07.11 and I can't find lRefreshOnlyData 2 times in the methode.
Regards,
Otto

METHOD Seek( cSeek ) CLASS TXBrowse

local uBook, uSeek
local nFor, nRows
local lRefresh

if ::bSeek == nil
return nil
endif

If cSeek == nil
if !Empty(::cSeek)
::cSeek := ""
If ::oSeek != nil
::oSeek:SetText("")
Endif
endif
return nil
Endif

uBook := Eval( ::bBookMark )

if !Eval( ::bSeek, cSeek )
Eval( ::bBookMark, uBook )
MsgBeep()
return nil
endif

if ::nRowSel > Eval( ::bKeyNo )
::nRowsel := 1
else
::lRefreshOnlyData := .t. //<======================here
endif

::cSeek := cSeek
uSeek := Eval( ::bBookMark )
nRows := ::nDataRows
lRefresh := .t.

if ::oSeek != nil
::oSeek:SetText( cSeek )
endif

Eval( ::bBookMark, uBook )
Eval( ::bSkip, 1 - ::nRowSel )

for nFor := 1 to nRows
if Eval( ::bBookMark ) == uSeek
lRefresh := .f.
exit
endif
if Eval( ::bSkip, 1) == 0
exit
endif
next

if lRefresh
Eval( ::bBookMark, uSeek )
if ::bChange != nil
Eval( ::bChange, Self )
endif
// ::lRefreshOnlyData := .t. //<===================here
::Super:Refresh(.f.)
else
Eval( ::bBookMark, uBook )
::DrawLine( .f. )
::nRowSel := nFor
Eval( ::bBookMark, uSeek )
if ::bChange != nil
Eval( ::bChange, Self )
endif
::DrawLine( .t. )
endif

if ::oVScroll != nil
::VSetPos( Eval( ::bKeyNo,,Self ) )
endif

return nil

Posted: Mon Nov 12, 2007 8:58 am
by Otto
Antonio, thank you this code works.

Regards,
Otto