home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Phoenix CD 2.0
/
Phoenix_CD.cdr
/
02a
/
pardoxed.zip
/
EDITOR.SC
< prev
next >
Wrap
Text File
|
1987-08-15
|
6KB
|
230 lines
PROC FANCEDIT(tblname)
Clear ; clear environment
ClearAll
View tblname ; view table choice passed to procedure
keystrk = 1 ; this sets counter for autosave feature
While (true) ; infinite loop, will break upon F2
; if table is empty FormKey will cause an error if not in edit mode
if sysmode() <> "Edit"
then
EditKey
endif
; simple error check to insure form mode
if NOT(isformview())
then
Formkey
endif
Wait Record
Until "F1","CtrlPgUp","CtrlPgDn","F2","F7","Home","End","F9","F10",
"Del","F6","F5","F4","F3","F8"
if retval = "F1"
then
Play "help"
endif
If retval = "F4" ; is ditto plus clears field first
then
CtrlBackspace
Ditto
endif
IF retval = "CtrlPgUp" ; in formmode user can only go one Page at a time
then ; this is quicker method to move up
value = recno()
if value < 15
then
value = 1
message "At beginnng of file"
else
value = value -15
endif
moveto record value
endif
if retval = "CtrlPgDn" ; same as above only goes down
then
value = recno()
if (value+15) > nrecords(tblname)
then
value = nrecords(tblname)
message "At end of file"
else
value = value + 15
endif
MOVETO RECORD value
endif
if retval = "F7" ; in edit mode in Paradox this allows user to enter
then ; a table mode - most normal editing keys work
FormKey ; for data entry people this may be a dangerous
Wait Table
message "when done scrolling in table mode to exit type F7"
Until "F7"
FormKey ; function to allow since the del key is not protected
endif ; in this version, in form mode del key is caught, so veri-
; fication is possible - you can modify to your requirements
if retval = "F8" ; Duplicates record a certain number of times. repeat
then ; is included in the archive
Do_it!
Play "repeat"
Do_It!
endif
if retval = "F2" ; saves, F2 because that is PDX standard
then
Do_It!
ClearAll
Clear
Return
endif
if retval = "F3"
then
Do_It! ; save work, this function is disk intensive
ClearAll
Savevars tblname
Play "search"
endif
if retval = "F10" ; this will move one record down in form mode,
then ; in normal form mode if form is multipage user would
value = recno() ; have to use PgDn a great deal, this is better
if value = nrecords(tblname)
then
FormKey
Down
CtrlHome
Message " At Bottom of file! "
sleep 250
else
value = value +1
moveto record value
endif
endif
if retval = "F9" ; same as F10 but moves user up
then
value = recno()
if (value - 1) = 0
then
message "You are at beginning of file"
sleep 250
else
value = value -1
moveto record value
endif
endif
if retval = "Home" ; similar to PDX edit mode HOME moves user to beg of file
then
Do_It!
moveto record 1
endif
if retval = "End" ; similar to PDX edit mode END moves user to end of file
then
Do_It!
moveto record nrecords(tblname)
endif
if retval = "Del" ; this is the guard in form mode to do what PDX does not
then ; ask if you really want to del record and usr often does
? "Are you sure you wish to Delete Record(Y or N): "
Accept "A1" Default "N" to reply
value = recno()
if reply = "Y" ; does not see the record get delete to fast typing, etc..
then
Del
message "Record ",value," deleted"
sleep 250
endif
endif
if retval = "F6" ; copies current record in to a newly inserted one record after
then ; the current file pointer
value = recno()
copytoarray b
CtrlHome
Down
Ins
copyfromarray b
message "Record ",value," copied into new record ",value+1
sleep 350
endif
If retval = "F5" ; allows user to edit text field like a word processor
then
FieldView
Wait Field
message " Press F2 when done with field "
Until "F2"
endif
if keystrk > 20 ; autosave is set at twenty times through loop, you may
then ; set it at any value you wish, but this seems to work well
Do_It!
keystrk=1
else
keystrk = keystrk + 1
endif
Endwhile
ENDPROC
; end of generic file edit proc
ClearAll
CLEAR
;@2,2 ?? "Do you wish to empty previous po's(Y/N):"
;accept "A1" to getposready
;if ((getposready="y") or (getposready="Y"))
; then
; Clear
; Message "POS now being cleared - in new data entry mode"
; Empty "POS"
;endif
;fancedit("c:\\programs\\paradox\\pos\\pos")
; above is example of a hardwired script for editing, this editor is small enough
; including its support scripts repeat, search, help can be in every directory
; for each application - most people put each application in one directory -
; purchase orders, AR, etc....
; if you wish to have this editor work for all tables I have included the
; code for this, so the first try can be editing tables which are in the
; current directory or others.
Clear
@1,1 ?? "Editor! Pernell J Dykes Micro-consulting"
@24,1 ?? "A contribution is greatly appreciated, see the help menu!"
@22,1 ?? "When in editor F1 is the help key!!!"
@15,5 ??"Example of file entry for current directory is 'database' with no"
@16,5 ??"other extension. If wish to edit another directory use double slashes"
@18,5 ??" For Example : 'c:\\paradox\\acctrecv\\database' "
@6,2 ?? "Enter file to edit, if in this directory erase default and put table:"
@7,2 ?? ">"
Accept "A50" Default "c:\\paradox\\" to direcpath
if istable(direcpath)
then
fancedit(direcpath)
else
Clear
@2,2 ?? "Table does not exist, or directory is incorrect, rerun script."
sleep 8000
Clear
endif
Return