home *** CD-ROM | disk | FTP | other *** search
- on keyDown
- global menuText, tempText, displayLines, indexText, CR, endLinePtr, offsetPtr, LinePtrs
- set fldLen to the number of chars in field 442
- if not integerp(fldLen) then
- set fldLen to 0
- end if
- set dontAdd to 0
- dontPassEvent()
- set theKey to the key
- if charToNum(theKey) = 13 then
- exit
- else
- if charToNum(theKey) = 8 then
- delete char the number of chars in field 442 of field 442
- set theChar to char the number of chars in field 442 of field 442
- set fldLen to fldLen - 1
- set offsetPtr to value(item 1 of line fldLen + 1 of LinePtrs)
- set endLinePtr to value(item 2 of line fldLen + 1 of LinePtrs)
- set theChar to item 3 of line fldLen of LinePtrs
- delete line fldLen + 1 of LinePtrs
- set dontAdd to 1
- else
- if charToNum(theKey) < 32 then
- exit
- end if
- end if
- end if
- if fldLen = 0 then
- if dontAdd <> 1 then
- set offsetPtr to 0
- set theChar to capitalise(theKey)
- put theChar after field 442
- set endLine to the number of lines in indexText
- set LinePtrs to 1 & "," & endLine & "," & theChar
- getFirstLinePos(indexText, 1, endLine, 1, theChar)
- if testError() = 1 then
- exit
- end if
- set endLinePtr to endLine
- getLastLinePos(indexText, 1, endLinePtr, 1, theChar)
- if testError() = 1 then
- exit
- end if
- end if
- else
- if dontAdd <> 1 then
- set theChar to theKey
- put theChar after field 442
- put CR & offsetPtr & "," & endLinePtr & "," & theChar after LinePtrs
- set oldOffsetPtr to offsetPtr
- set oldEndLinePtr to endLinePtr
- getFirstLinePos(indexText, offsetPtr, endLinePtr, fldLen + 1, theChar)
- if testError() = 1 then
- delete char the number of chars in field 442 of field 442
- exit
- end if
- getLastLinePos(indexText, oldOffsetPtr, oldEndLinePtr, fldLen + 1, theChar)
- if testError() = 1 then
- exit
- end if
- end if
- end if
- if offsetPtr > 0 then
- set the castNum of sprite 47 to 604
- updateStage()
- set tempText to line offsetPtr to offsetPtr + displayLines - 1 of menuText
- put tempText into field 441
- set totLines to the number of lines in menuText
- if the locH of sprite 48 < 1000 then
- set theLocV to the locV of sprite 48
- set the visible of sprite 48 to 0
- set theLocV to theLocV + (the textHeight of field 441 * offsetPtr)
- set the locV of sprite 48 to theLocV
- if (theLocV < the bottom of sprite 39) and (theLocV >= the top of sprite 39) then
- set the visible of sprite 48 to 1
- end if
- end if
- setScroll(47, offsetPtr, totLines, 441)
- set the castNum of sprite 47 to 449
- end if
- end
-
- on testError
- global gErrGlobal
- if gErrGlobal = 1 then
- set gErrGlobal to 0
- return 1
- else
- return 0
- end if
- end
-