xBrowse - incremental search

xBrowse - incremental search

Postby Otto » Mon Nov 12, 2007 7:37 am

If I search and the find position is not on the first page I lose the header and the row pointer.

Image
Image
User avatar
Otto
 
Posts: 6064
Joined: Fri Oct 07, 2005 7:07 pm

Postby Biel EA6DD » Mon Nov 12, 2007 8:28 am

Search the string ::lRefreshOnlyData := .T. (2 times) in the method Seek of txBrowse, coment it.
Saludos desde Mallorca
Biel Maimó
http://bielsys.blogspot.com/
User avatar
Biel EA6DD
 
Posts: 682
Joined: Tue Feb 14, 2006 9:48 am
Location: Mallorca

Postby Otto » Mon Nov 12, 2007 8:33 am

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
User avatar
Otto
 
Posts: 6064
Joined: Fri Oct 07, 2005 7:07 pm

Postby Antonio Linares » Mon Nov 12, 2007 8:39 am

Otto,

Use this code:
Code: Select all  Expand view
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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41392
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Biel EA6DD » Mon Nov 12, 2007 8:41 am

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
Saludos desde Mallorca
Biel Maimó
http://bielsys.blogspot.com/
User avatar
Biel EA6DD
 
Posts: 682
Joined: Tue Feb 14, 2006 9:48 am
Location: Mallorca

Postby Otto » Mon Nov 12, 2007 8:58 am

Antonio, thank you this code works.

Regards,
Otto
User avatar
Otto
 
Posts: 6064
Joined: Fri Oct 07, 2005 7:07 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 42 guests