Skip to main content
Version: 20 R7 BETA

Is editing text

Is editing text : Boolean

ParameterTypeDescription
Function resultBooleanTrue if text is being entered, False otherwise

Description

The Is editing text command returns True if the user is entering values in an input form object, and False in all other cases.

This command is mainly to be used to distinguish, within code triggered by the On Before Keystroke form event, between actual user data entry and use of shortcut keys. For example, you might want to execute a different code whether the user is pressing a key to enter text in a cell, or to scroll the listbox.

The Is editing text command can only be used with the following form objects:

  • input
  • listbox (enterable and non-enterable)
  • combo box

With other objects, the command always returns False. In particular, it cannot be used with 4D Write Pro and 4D View Pro areas.

Example

You want to allow the user to select a row beginning with the typed letter or number in an enterable listbox:

 Case of
    :(FORM Event.code=On Before Keystroke) //a key is pressed
       If(Is editing text) //text is entered
  // you disallow some characters
          If(Keystroke="+")|(Keystroke="-")|(Keystroke="/")|(Keystroke="*")
             FILTER KEYSTROKE("")
          End if
       Else
  //nothing is beeing entered, scrolling shortcut feature
          $charCode:=Keystroke
          $char:=Uppercase($charCode) // removes accents
          Case of
             :((($char>="A")&($char<="Z"))|(($char>="0")&($char<="9")))
                ... //Select a row beginning with the typed letter or number
             :($charCode>=Left arrow key)&($charCode<=Down arrow key) // left/right/up/down arrows
                FILTER KEYSTROKE("") // disable actions of arrows
          End case
       End if
 End case

See also

FILTER KEYSTROKE
Get edited text
Type ahead made easy (blog post)

Properties

Command number1744
Thread safe