TEdit

Source: source/classes/edit.prg

Inherits from: TControl

TEdit wraps the standard Windows EDIT control, supporting both single-line and multi-line text editing. It features picture clause formatting, password mode, read-only mode, cue banners, character limits, and alignment options (left, right, center). TEdit is especially useful for multi-line text wherever TGet is too constrained.

Key DATA Members

DATATypeDescription
bSetGetBlockCode block to get/set the bound variable
lReadOnlyLogicalWhen true, the edit text cannot be modified
lPasswordLogicalPassword mode (displays bullets instead of characters)
lMultiLineLogicalMulti-line edit mode with scrollbars
nLimitCharsNumericMaximum number of characters allowed
cPictureCharacterPicture clause for formatted display (e.g. "999.99")
cCueTextCharacterWatermark/cue banner text shown when empty
bHScrollBlockCode block evaluated on horizontal scroll events

Methods

MethodDescription
New( nRow, nCol, bSetGet, oWnd, nW, nH, lPixel, oFont, cPict, bChanged, bUpdate, bHScroll, lMultiLine, lReadOnly, lPassword, lRight, lCenter, lNumber, lUpper, lUpdate, bWhen, bValid, lLimitText, nLimitChars, cCueText )Create a new EDIT control
ReDefine( nId, oWnd, bSetGet, ... )Redefine from a dialog resource
SetSel( nStart, nEnd )Select a range of text characters
SelectAll()Select all text in the control
SetLimitText( n )Set the maximum text length (EM_LIMITTEXT)
SetCueBanner( lOnFocus, cText )Set the cue banner (watermark) text
VarPut( uVal )Set the bound variable to a new value
cText( uVal )Get or set the edit window text
Value()Return the current value from bSetGet
Read()Read text from the control into bSetGet

Example: Multi-Line Edit Box

#include "FiveWin.ch"

function Main()

   local oWnd, oEdit, cText := MemoRead( "notes.txt" )

   DEFINE WINDOW oWnd TITLE "TEdit Demo" SIZE 600, 400

   @ 10, 10 EDIT oEdit VAR cText ;
      OF oWnd ;
      SIZE 560, 340 ;
      MULTILINE

   ACTIVATE WINDOW oWnd CENTERED

return nil

Notes

See Also