Skip to main content
Version: Next

On After Edit

CodeCan be called byDefinition
454D View Pro area - 4D Write Pro area - Combo Box - Form - Input - Hierarchical List - List Box - List Box ColumnThe contents of the enterable object that has the focus has just been modified

Description

General case

This event can be used filter the data entry in keyboard enterable objects at the lowest level.

When it is used, this event is generated after each change made to the contents of an enterable object, regardless of the action that caused the change, i.e.:

  • Standard editing actions which modify content like paste, cut, delete or cancel;
  • Dropping a value (action similar to paste);
  • Any keyboard entry made by the user; in this case, the On After Edit event is generated after the On Before Keystroke and On After Keystroke events, if they are used.
  • Any modification made using a language command that simulates a user action (i.e., POST KEY).

Within the On After Edit event, text data being entered is returned by the Get edited text command.

4D View Pro

The object returned by the FORM Event command contains:

PropertyTypeDescription
codelongintOn After Edit
descriptiontext"On After Edit"
objectNametext4D View Pro area name
sheetNametextName of the sheet of the event
actiontext"editChange", "valueChanged", "DragDropBlock", "DragFillBlock", "formulaChanged", "clipboardPasted"

Depending on the action property value, the event object will contain additional properties.

action = editChange

PropertyTypeDescription
rangeobjectCell range
editingTextvariantThe value from the current editor

action = valueChanged

PropertyTypeDescription
rangeobjectCell range
oldValuevariantValue of cell before change
newValuevariantValue of cell after change

action = DragDropBlock

PropertyTypeDescription
fromRangeobjectRange of source cell range (being dragged)
toRangeobjectRange of the destination cell range (drop location)
copybooleanSpecifies if the source range is copied or not
insertbooleanSpecifies if the source range is inserted or not

action = DragFillBlock

PropertyTypeDescription
fillRangeobjectRange used for fill
autoFillTypelongintValue used for the fill.
  • 0: Cells are filled with all data (values, formatting, and formulas)
  • 1: Cells are filled with automatically sequential data
  • 2: Cells are filled with formatting only
  • 3: Cells are filled with values but not formatting
  • 4: Values are removed from the cells
  • 5: Cells are filled automatically
  • fillDirectionlongintDirection of the fill.
  • 0: The cells to the left are filled
  • 1: The cells to the right are filled
  • 2: The cells above are filled
  • 3: The cells below are filled
  • action = formulaChanged

    PropertyTypeDescription
    rangeobjectCell range
    formulatextThe formula entered

    action = clipboardPasted

    PropertyTypeDescription
    rangeobjectCell range
    pasteOptionlongintSpecifies what is pasted from the clipboard:
  • 0: Everything is pasted (values, formatting, and formulas)
  • 1: Only values are pasted
  • 2: Only the formatting is pasted
  • 3: Only formulas are pasted
  • 4: Values and formatting are pasted (not formulas)
  • 5: Formulas and formatting are pasted (not values)
  • pasteDataobjectThe data from the clipboard to be pasted
  • "text" (text): The text from the clipboard
  • "html" (text): The HTML from the clipboard
  • Example

    Here is an example handling an On After Edit event:

     If(FORM Event.code=On After Edit)
    If(FORM Event.action="valueChanged")
    ALERT("WARNING: You are currently changing the value\
    from "+String(FORM Event.oldValue)+\
    " to "+String(FORM Event.newValue)+"!")
    End if
    End if

    The above example could generate an event object like this:

    {

    "code":45;
    "description":"On After Edit";
    "objectName":"ViewProArea"
    "sheetname":"Sheet1";
    "action":"valueChanged";
    "range": {area:ViewProArea,ranges:[{column:1,row:2,sheet:1}]};
    "oldValue":"The quick brown fox";
    "newValue":"jumped over the lazy dog";
    }