Function ReadInsert() Foundation
Reads/sets insertion mode for GET input fields or MemoEdit().
ReadInsert( [<lToggle>] ) --> lInsert
When ReadInsert() is called without an argument, it returns the current setting as a logical value. If <lToggle> is passed, it becomes the new setting and the old setting is returned.
ReadInsert() returns and optionally sets the insertion mode for data input. If ReadInsert() returns .T. (true), new characters are inserted by keyboard input in a GET field or by MemoEdit(), otherwise, characters are overwritten.
// In the example, the current setting from ReadInsert() is saved and
// set to .T. in the same call. Then a half block cursor is displayed.
#include "Setcurs.ch"
PROCEDURE Main
LOCAL cVar1 := "The insertion mode"
LOCAL cVar2 := "is"
LOCAL cVar3 := "turned on"
LOCAL lSave := ReadInsert(.T.) // Saves old value, sets new
// value
CLS
SetCursor( SC_SPECIAL2 )
@ 10,10 SAY "Value1:" GET cVar1
@ 11,10 SAY "Value2:" GET cVar2
@ 12,10 SAY "Value3:" GET cVar3
READ
SetCursor( SC_NONE )
ReadInsert( lSave ) // Sets back old value
RETURN
// In the example, a very frequent use of
// ReadInsert() is illustrated:
//
// Toggling the cursor form and insert mode
// automatically when the insert key is pressed.
//
// In insert mode, a full block cursor is displayed; in
// overwrite mode, the cursor is a normal underscore.
// This occurs in a code block which is executed when the insert key
// is pressed. MemoEdit() is used as the data input function.
#include "Inkey.ch"
#include "Setcurs.ch"
PROCEDURE Main
LOCAL cText, bBlock
cText := MemoRead("TEST.TXT")
bBlock := ;
{|| SetCursor( ; // Changes cursor form
IIf( ReadInsert( ! ReadInsert() ),; // Inserts .T.|.F.
SC_NORMAL, SC_SPECIAL1 ; // value for
) ) ; // Setcursor()
}
SET SCOREBOARD OFF
SetKey( K_INS, bBlock ) // Assigns code block to key
cText := MemoEdit( cText, 5, 5, 20, 75 ) // Edits
MemoWrit( "TEST.TXT", cText )
SET SCOREBOARD ON
SetKey( K_INS, NIL ) // Reset
RETURN
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.