4D v14.3

Get edited text

Home

 
4D v14.3
Get edited text

Get edited text 


 

Get edited text -> Function result 
Parameter Type   Description
Function result  Text in Text being entered

The Get edited text command is mainly to be used with the form event On After Keystroke to retrieve the text as it is being entered. It can also be used with the On Before Keystroke form event. For more information about those form events, please refer to the description of the command Form event.

When used in a context other than text entry in a form object, this function returns an empty string.

The following method automatically puts the characters being entered in capitals:

 If(Form event=On After Keystroke)
    [Trips]Agencies:=Uppercase(Get edited text)
 End if

Here is an example of how to process on the fly characters entered in a text field. The idea consists of placing in another text field (called “Words”) all the words of the sentence being entered. To do so, write the following code in the object method of the field:

 If(Form event=On After Keystroke)
    $RealTimeEntry:=Get edited text
    PLATFORM PROPERTIES($platform)
    If($platform#3) ` Mac OS
       Repeat
          $DecomposedSentence:=Replace string($RealTimeEntry;Char(32);Char(13))
       Until(Position(" ";$DecomposedSentence)=0)
    Else ` Windows
       Repeat
          $DecomposedSentence:=Replace string($RealTimeEntry;Char(32);Char(13)+Char(10))
       Until(Position(" ";$DecomposedSentence)=0)
    End if
    [Example]Words:=$DecomposedSentence
 End if

Note: This example is not comprehensive because we have assumed that words are separated uniquely by spaces (Char (32)). For a complete solution you will need to add other filters to extract all the words (delimited by commas, semi-colons, apostrophes, etc.).

 
PROPERTIES 

Product: 4D
Theme: Entry Control
Number: 655

 
HISTORY 

Created: 4D v6.5

 
SEE ALSO 

Form event

 
ARTICLE USAGE

4D Language Reference ( 4D v14 R2)
4D Language Reference ( 4D v13.5)
4D Language Reference ( 4D v14 R3)
4D Language Reference ( 4D v14.3)
4D Language Reference ( 4D v14 R4)

Inherited from : Get edited text ( 4D v12.4)