home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Pier Shareware 6
/
The_Pier_Shareware_Number_6_(The_Pier_Exchange)_(1995).iso
/
008
/
beechl.zip
/
DEMO.PRG
< prev
next >
Wrap
Text File
|
1994-10-06
|
3KB
|
80 lines
* ┌─ Function ───────────────────────────────────────────────────────────────┐
* │ Name: main Docs: AWB │
* │ Description: │
* │ Author: Andrew Bell │
* │ Date created: 24-05-94 Date updated: ■24-05-94 │
* │ Time created: 02:35:29pm Time updated: ■02:35:29pm │
* │ Copyright: A W Bell 1994 │
* ├──────────────────────────────────────────────────────────────────────────┤
* │ Arguments: None │
* │ Return Value: (Nil) │
* │ See Also: │
* └──────────────────────────────────────────────────────────────────────────┘
//compile with the /N switch
//Link rtlink fi demo lib beechlib
#INCLUDE "inkey.CH"
static cAction := '', nMemoRow:=0, nMemoCol:=1 //needs to be file wide
function main
/*
Demonstrates the search and replace functions in action
*/
local cOldScreen := savescreen()
local cOldColor := setcolor("b/w,w+/b"),aRes
local cFile := memoread("memos.doc")
cls
set scoreboard off
bl_box(5,5,20,75,"Demo - Press F9 to do a search")
do while cAction <> "QUIT"
//normally we'd save the result, but this is just a demo
cFile:=memoedit(cFile,7,6,19,74,.t.,"memocontrol",255,,nMemoRow,nMemoCol)
IF cAction=="SEARCH"
aRes:=bl_searchmem(@cFile,7,6,19,74,nMemoRow,nMemoCol)
nMemoRow:=aRes[1]
nMemoCol:=aRes[2]
ENDIF
enddo
restscreen(,,,,cOldScreen)
return (Nil)
* ┌─ Function ───────────────────────────────────────────────────────────────┐
* │ Name: memocontrol() Docs: AWB │
* │ Description: │
* │ Author: Andrew Bell │
* │ Date created: 24-05-94 Date updated: ■24-05-94 │
* │ Time created: 02:43:52pm Time updated: ■02:43:52pm │
* │ Copyright: A W Bell 1994 │
* ├──────────────────────────────────────────────────────────────────────────┤
* │ Arguments: mode │
* │ : nLine │
* │ : nCol │
* │ Return Value: (Nil) │
* │ See Also: │
* └──────────────────────────────────────────────────────────────────────────┘
function memocontrol(mode,nLine,nCol)
//test the mode
DO CASE
CASE mode == 3
return 0
CASE mode <> 0
IF lastkey(0)==K_F9
cAction:="SEARCH"
nMemoRow:=nLine
nMemoCol:=nCol
return K_CTRL_END
elseif lastkey()==K_ESC .OR. lastkey()==K_CTRL_W
cAction:="QUIT"
return K_CTRL_END
ENDIF
ENDCASE
return 0