Edit Box Events

Not supported by TWC

Event icon The Edit Box supports the following scripting events. Click next to any event name in the Events pane to see a short description for the selected event.

See Accessing Screen Objects for more information about how to view control objects in script in the Canvas application.

When an event is enabled, the control will be automatically added to script and the Include in script property will be set to True.

Event Description

Close

The Close event is called when the screen is closed.

Initialize

The Initialize event is called when the screen is created in preview or run mode to allow further initialization of the control.

Key Down

The Key Down event is called when a key on the keyboard is pressed while this control has focus.

The following example shows how to use the Key Down event for the Enter key. Apply whatever actions you want to any key.

Note: In order to access to the key-related properties of the event arguments, you will need to add a reference to the WindowsBase system assembly using the Canvas Assembly Manager. After adding the reference, you will be able to safely use the System.Windows.Input.Key element. See Managing External Assemblies for more information about adding assemblies.

Example

Copy
Key Down event
#region EditBox
 
private void EditBox_KeyDown(object sender, EventArgs args)
{
    var key = (args as System.Windows.Input.KeyEventArgs).Key;
    if (key == System.Windows.Input.Key.Enter)
    {
        MessageBox.Show($"Text: {Objects.EditBox.Text}");
    }
}
 
#endregion

See Event Argument Type for more information about EventArgs.

Key Up

The Key Up event is called when a key on the keyboard is released while this control has focus.

The following example shows how to use the Key Up event for the Enter key. Apply whatever actions you want to any key.

Note: In order to access to the key-related properties of the event arguments, you will need to add a reference to the WindowsBase system assembly using the Canvas Assembly Manager. After adding the reference, you will be able to safely use the System.Windows.Input.Key element. See Managing External Assemblies for more information about adding assemblies.

Example

Copy
Key Up event
#region EditBox
 
private void EditBox_KeyUp(object sender, EventArgs args)
    {
        var key = (args as System.Windows.Input.KeyEventArgs).Key;
        if (key == System.Windows.Input.Key.Enter)
        {
            MessageBox.Show($"Text: {Objects.EditBox.Text}");
        }
    }
 
#endregion

See Event Argument Type for more information about EventArgs.

Loaded

The Loaded event is called when the control is rendered and ready for interaction.

Mouse Enter

The Mouse Enter event is called when the mouse pointer enters (moves over) a control.

Mouse Leave

The Mouse Leave event is called when the mouse pointer leaves (moves out of) a control.

See Order of Event Execution for information about the order in which events are executed on a screen.