home *** CD-ROM | disk | FTP | other *** search
- *:*****************************************************************************
- *:
- *: Procedure file: D:\SUPRSEEK.PRG
- *:
- *: Author: Wayne A. Willingham
- *: Copyright (c) 1993, Survivor Software Solutions
- *:
- *: PO Box 832366
- *: Richardson, TX 75083
- *: Voice: (214) 783-0094 Fax: (214) 783-0095
- *: CompuServe 76170,2016
- *:
- *: Last modified: 09/10/93 2:23
- *:
- *:*****************************************************************************
- *: SuperSeek is freeware, as long as the author is given credit,
- *: and is informed of any nice improvements you make! <g>
- *:*****************************************************************************
- *:
- *: SuperSeek! is designed to do instant searches on the current index
- *: when that index is UPPER(<fieldname>) on any character field
- *:
- *: This is very similar to a Quicken search routine
- *:
- *: PARAMETERS are as follows:
- *: lnRow = Row to start SuperSeek! window on
- *: lnCol = Column to start SuperSeek! window on
- *: lcWind= Window to put Superseek! window in
- *:
- *: By telling SuperSeek the row, column and window,
- *: you can place the Superseek window right on top
- *: of the field you're searching on. Since the
- *: SuperSeek window is exactly the same size as
- *: there are characters in that field, it looks
- *: like a select-on-entry GET.
- *:
- *: This program makes extensive use on SYS(14) and SYS(21)
- *:
- *: The following is text I put into the help file,
- *: putting "SET TOPIC TO SUPERSEEK" in the procedure.
- *:
- *: ╓──────────────────────────╖
- *: ║ SuperSeek! ║
- *: ╙──────────────────────────╜
- *:
- *: With SuperSeek!, you can find any given
- *: record almost instantly.
- *:
- *: SuperSeek is available from the Database
- *: pull-down menu. Just start typing what
- *: you're looking for, and it'll appear. If
- *: there is no matching entry, a beep will
- *: sound, and you can try again.
- *:
- *: Even after searching, you can press
- *: ESCAPE to quit SuperSeek, and stay on the
- *: record you started SuperSeek from.
- *:
- *: The DELETE key clears the SuperSeek
- *: highlight so you can start from scratch.
- *:
- *: The up/down arrow keys will move you through
- *: the database forward or backward in order by
- *: the field you're in.
- *:
- *: The left/right arrow keys add or subtract
- *: letters from your search string.
- *:
- *: Press ENTER to stay on the found record.
- *:
- *:
- *:*****************************************************************************
- PARAMETERS lnRow, lnCol, lcwind
-
- **** Verify that index is UPPER(expC)?
- IF TYPE(sys(14,val(sys(21)))) <> "C" AND !("UPPER"$sys(14,val(sys(21))))
- WAIT WINDOW TIMEOUT 30 "Index must be upper(character) type!"
- RETURN
- ENDIF
-
- **** Define variable & store environment settings
- PRIVATE tofind, oldrec
- tofind = "" && What we're SEEKing
- oldrec = recno() && In case of abort, return to old record
- oldins = insmode() && Save current INSMODE() status
- =INSMODE(.f.) && Let's get a BIG CURSOR using INSMODE
-
- **** SCREEN LAYOUT ****
- *** If no parameters, center the seek window
- IF PARAMETERS() < 1
- lnRow = INT(srows()/2)-1
- ENDIF
- IF PARAMETERS() < 2
- lnCol=IIF(int(scols()-len(evaluate(sys(14,val(sys(21)))))-14)/2<15,15, ;
- int(scols()-len(evaluate(sys(14,val(sys(21)))))-14)/2)
- ENDIF
-
- *** If no window is specified, place window in screen
- c_where=IIF(PARAMETERS() > 2,lcwind,"screen")
-
- DEFINE WINDOW fastseek IN (c_where) FROM lnRow,lnCol ;
- TO lnRow,lnCol-1+LEN(EVALUATE(SYS(14,VAL(SYS(21))))) ;
- NONE NOCLOSE NOZOOM NOFLOAT ;
- COLOR SCHEME 6
- ACTIVATE WINDOW fastseek NOSHOW
- DO upd_disp
-
- *** Tell the user what's happening, and start
- WAIT WINDOW NOWAIT "SuperSeek on "+order()
- ACTIVATE WINDOW fastseek
-
- active = .t. && exit variable
- DO WHILE active
- DO keyin
- ENDDO
-
- *** cleanup
- SHOW GETS
- DEACTIVATE WINDOW fastseek
- RELEASE WINDOW fastseek
- =INSMODE(oldins)
- SHOW GETS
-
- *** the actual display
- PROC upd_disp
- * clear line
- @ 0,0 SAY SPACE(LEN(EVALUATE(sys(14,val(sys(21)))))) COLOR SCHEME 6
- * put in what has been found
- @ 0,0 SAY ALLTRIM(IIF(EMPTY(tofind),SPACE(LEN(EVALUATE(SYS(14,val(SYS(21)))))), ;
- EVALUATE(SYS(14,VAL(SYS(21)))))) COLOR SCHEME 6
- * overlay with the SEEK expression
- @ 0,0 SAY tofind COLOR SCHEME 5
- SHOW GETS
-
-
- *** take keystroke, evaluate action, or add to SEEK string
- PROC keyin
- DO upd_disp
- key = INKEY(15,"S")
- DO CASE
- CASE key=0 OR key=9 OR key=27 OR (key=13 AND EMPTY(tofind)) && ESCAPE
- GO oldrec
- active = .F.
- RETURN
- CASE key = 13 && RETURN
- active = .F.
- RETURN
- CASE key = 127 OR key = 19 && BACKSPACE/LEFTARROW
- tofind = LEFT(tofind,LEN(tofind)-1)
- CASE key = 7 OR key = 1 && DELETE/HOME
- tofind = ""
- CASE key = 4 && RIGHTARROW
- tofind = LEFT(EVALUATE(SYS(14,VAL(SYS(21)))),LEN(tofind)+1)
- CASE key = 5 && UPARROW
- SKIP -1
- IF BOF()
- GO TOP
- ENDIF
- tofind = ALLTRIM(EVALUATE(SYS(14,VAL(SYS(21)))))
- CASE key = 24 && DOWNARROW
- SKIP 1
- IF EOF()
- GO BOTTOM
- ENDIF
- tofind = ALLTRIM(EVALUATE(SYS(14,VAL(SYS(21)))))
- OTHERWISE && ALL ELSE
- newkey = UPPER(CHR(key))
- tofind = tofind+newkey
- *** if string not found, shorten it by one character
- DO WHILE !SEEK(tofind) AND LEN(tofind)>0 AND active
- ?? CHR(7)
- tofind = LEFT(tofind,LEN(tofind)-1)
- ENDDO
- ENDCASE
- *: EOF: SUPRSEEK.PRG
-
-