home *** CD-ROM | disk | FTP | other *** search
- // MemoRead.prg
- //
- // Get reader for memo fields
-
- #define VAR_ELEM 1
- #define COORDS_ELEM 2
-
- #include "Getexit.ch"
- #include "Inkey.ch"
-
- proc MemoReader( oGet )
-
- // read the GET if the WHEN condition is satisfied
- IF ( GetPreValidate(oGet) )
- // activate the GET for reading
- oGet:SetFocus()
-
- DO WHILE ( oGet:exitState == GE_NOEXIT )
- // apply keystrokes until exit
- DO WHILE ( oGet:exitState == GE_NOEXIT )
- GetMemoApplyKey(oGet, InKey(0))
- ENDDO
-
- // disallow exit if the VALID condition is not satisfied
- IF ( !GetPostValidate(oGet) )
- oGet:exitState := GE_NOEXIT
- ENDIF
- ENDDO
-
- // de-activate the GET
- oGet:KillFocus()
- ENDIF
-
- RETURN
-
-
- FUNCTION EditMemo(oGet)
-
- LOCAL t, l, b, r, aCoords, cSaveScreen, nRow, nCol
-
- aCoords := oGet:cargo[COORDS_ELEM]
- t := aCoords[1]
- l := aCoords[2]
- b := aCoords[3]
- r := aCoords[4]
-
- cSaveScreen := SaveScreen(t, l, b, r)
- nRow := Row()
- nCol := Col()
-
- @ t, l CLEAR TO b, r
- @ t, l TO b, r
- oGet:cargo[VAR_ELEM] := MemoEdit(oGet:cargo[VAR_ELEM], ;
- t + 1, l + 1, b - 1, r - 1)
- oGet:VarPut(oGet:cargo[VAR_ELEM])
- oGet:updateBuffer()
- DevPos(nRow, nCol)
- RestScreen(t, l, b, r, cSaveScreen)
-
- RETURN NIL
-
-
- FUNCTION MemoGetNew(cVar, bBlock, cName, bvalid, bWhen, aMemoCoords)
-
- LOCAL oGet := GetNew(Row(), Col(), bBlock, cname)
-
- oGet:postBlock := bValid
- oGet:preBlock := bWhen
- oGet:cargo := {cVar, aMemoCoords}
-
- RETURN oGet
-
-
- FUNCTION GetMemoApplyKey(oGet, nKey)
-
- LOCAL bKeyBlock
-
- // check for SET KEY first
- IF ( (bKeyBlock := SetKey(nKey)) <> NIL )
- GetDoSetKey(bKeyBlock, oGet)
- RETURN NIL // NOTE
- ENDIF
-
- DO CASE
- CASE nKey == K_UP
- oGet:exitState := GE_UP
-
- CASE nKey == K_SH_TAB
- oGet:exitState := GE_UP
-
- CASE nKey == K_DOWN
- oGet:exitState := GE_DOWN
-
- CASE nKey == K_TAB
- oGet:exitState := GE_DOWN
-
- CASE nKey == K_ENTER
- oGet:exitState := GE_ENTER
-
- CASE nKey == K_ESC
- IF Set(_SET_ESCAPE)
- oGet:exitState := GE_ESCAPE
- ENDIF
-
- CASE nKey == K_PGUP
- oGet:exitState := GE_WRITE
-
- CASE nKey == K_PGDN
- oGet:exitState := GE_WRITE
-
- CASE nKey == K_CTRL_HOME
- oGet:exitState := GE_TOP
-
- CASE nKey == K_CTRL_PGDN
- EditMemo(oGet)
- oGet:exitState := GE_ENTER
-
- ENDCASE
-
- RETURN NIL