Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sequential Search - FPW 2.6 -> VFP 5.0
Message
From
06/06/1997 11:45:12
 
 
To
06/06/1997 11:26:17
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00035412
Message ID:
00035415
Views:
33
>I have a sequential search routine that worked very well for me in my FPW 2.6 applications. I recently started using VFP 5.0 and would like to convert the code for use in my VFP development. I've been trying to do this but have been unsuccessful. Below is the code:
>
>I place this in the WHEN procedure of the text box property:
>
>FDValue="txtValue" && Text Box Value
>DBValue="name" && Table Search Field ID
>SELECT &TBValue && Select Table
>ThisForm.seqsearch(FDValue,DBValue) && Call Form Procedure
>SET ORDER TO && Reset Order Value
>ThisForm.Refresh && Refresh Form
>
>I place this in a self defined procedure called "seqsearch" in the form property:
>
>*************************
>* SEQSEARCH - Sequential Search
>* I modified this code from a program called "FastFind.prg".
>* I'm not sure who the author is, it's been so long I forget.
>*
>* As values are typed in the FDValue (txtValue) a large table
>* is searched on the indexed field and the first record matching
>* the string is echoed to a wait window. When the desired match
>* is found a RETURN will place the value into the txtValue Field.
>*************************
>LPARAMETERS FDValue, DBValue
>
>SET ORDER TO TAG &DBValue && Index must be uppercase
>
>WAIT WINDOW "Entering SEQSEARCH for "+UPPER(FDValue) NOWAIT
>
>IF NOT EMPTY(&FDValue)
> SEEK UPPER(&FDValue)
> ThisForm.Refresh
> WAIT WINDOW TRIM(&FDValue) NOWAIT
> SKValue=&FDValue
>ELSE
> SKValue=''
>ENDIF
>
>DO WHILE .T.
> skey = INKEY(0,"M")
> DO CASE
> CASE skey = 13 or skey=27 or skey=151 && RETURN/ESC/MOUSE Key
> IF skey=27 or EMPTY(SKValue)
> WAIT WINDOW &SKValue
> &FDValue=''
> SKValue='*** ACTION ABORTED ***'
> ELSE
> &FDValue=TRIM(&DBValue)
> ENDIF
> ThisForm.Refresh
> EXIT
> CASE skey=24 or skey=3 && DOWNARROW/PGDN Key pressed
> SKIP 1
> IF EOF()
> GO BOTTOM
> ENDIF
> &FDValue=UPPER(&DBValue)
> SKValue=TRIM(&DBValue)
> ThisForm.Refresh
> CASE skey=5 or skey=18 && UPARROW/PGUP Key pressed
> SKIP -1
> IF BOF()
> GO TOP
> ENDIF
> &FDValue=UPPER(&DBValue)
> SKValue=TRIM(&DBValue)
> ThisForm.Refresh
> CASE skey=6 && END Key pressed
> GO BOTTOM
> &FDValue=UPPER(&DBValue)
> SKValue=TRIM(&DBValue)
> ThisForm.Refresh
> CASE skey=1 && HOME Key
> GO TOP
> &FDValue=''
> SKValue=''
> ThisForm.Refresh
> CASE skey=127 && BACKSPACE Key pressed
> SKValue = SUBSTR(SKValue,1,LEN(SKValue)-1)
> WAIT WINDOW UPPER(SKValue) NOWAIT
> SET NEAR ON
> SEEK UPPER(SKValue)
> SET NEAR OFF
> &FDValue=UPPER(SKValue)
> ThisForm.Refresh
> CASE skey >= 48 AND skey <= 58 OR;
> skey >= 65 AND skey <= 90 OR;
> skey >= 97 AND skey <= 122 OR;
> skey = 32 OR skey = 44 OR skey = 46 && 0-9, A-Z, a-z, or Spacebar
> SKValue = SKValue+CHR(skey)
> WAIT WINDOW UPPER(SKValue) NOWAIT
> SET NEAR ON
> SEEK UPPER(SKValue)
> SET NEAR OFF
> &FDValue=UPPER(SKValue)
> ThisForm.Refresh
> OTHERWISE && Do nothing, no character to process
> ENDCASE
> WAIT WINDOW TRIM(&DBValue) NOWAIT
>ENDDO
>
>* End Procedure
>
>Any refinements or help that can be offered would be greatly appreciated.
>
>TIA
>
>/chris
>close1@rtto.psu.edu
Edward Pikman
Independent Consultant
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform