You are here:

FoxPro/Incremental search

Advertisement


Question
sir,
i am using foxpro2.6. Please give idea or coding about incremental search. i want to use it in my application

Answer
Hi Ck,
  VFP / Foxpro don't have an incremental search built-in. Still you can code it easily. I'll give you a direction, you build on it. In FoxPro 2.6, you've to code it completely. In the sense starting from displaying it, to select it and search it..

mkey=inkey()
do while mkey<>27  && Esc
  mkey=0
  do while mkey=0
     mkey=inkey()   && Captures the key pressed
  enddo
  do case
     case mkey = 5   && Uparrow
          skip -1
          if bof()
             go top
          endif
          ** Write code here to display the appropriate record
     case mkey = 24  && Downarrow
          skip
          if eof()
             go bott
          endif
          ** Write code here to display the appropriate record
     case betw(mkey,65,90) or betw(mkey,97,122) or inli(mkey,46,127,32,64) or betw(mkey,33,57)
     if mkey#127
        if mkey#32
           mfindstr=mfindstr+chr(mkey)
        else
           mfindstr=mfindstr+" "
        endif
     else
        xx=mfindstr
        if len(xx)>0
           mfindstr=subs(xx,1,len(xx)-1)
        else
           ?? chr(7)
        endif
     endif
     mnam=mfindstr
     xxxx=subs(Str(recn()+1000000,7),2,6)
     loca for subs(upper(fname),1,len(mnam))=upper(mnam)
     if found()
        ** Code here to highlight the found one...!
     else
        keyb chr(127)
        ?? chr(7)
        &xxxx
     endif
  endcase
enddo


Hope this helps..
This is just a direction..

Best regards,
Markish

FoxPro

All Answers


Answers by Expert:


Ask Experts

Volunteer


Markish

Expertise

I can answer general questions related to Foxpro from Version 2.0 to 9.0. I'll try to answer them as quickly as possible.

Experience

I've been into Dbase programming from age of 11. I've worked in versions from FoxPro 2.0 and Foxbase.
Education/Credentials
I've done my B.Tech (IT) with distinction from Anna University, Chennai - India.

Education/Credentials
I've done my B.Tech (IT) with distinction from Anna University, Chennai - India.

©2012 About.com, a part of The New York Times Company. All rights reserved.