ClearKey Property

Applies to TestComplete 15.62, last modified on March 19, 2024

Specifies the shortcut that will clear the component’s value.

Declaration

componentPropObj.ClearKey
Read-Write Property Integer
componentPropObj     One of the objects listed in the Applies To section  

Applies To

This property applies to the following objects:

TcxButtonEditProperties, TcxCalcEditProperties, TcxCheckBoxProperties, TcxComboBoxProperties, TcxCurrencyEditProperties, TcxDateEditProperties, TcxMemoProperties, TcxMRUEditProperties, TcxRadioGroupProperties, TcxSpinEditProperties, TcxTextEditProperties, TcxTimeEditProperties

Description

The ClearKey property specifies the shortcut that, when pressed while the component is active, clears the component’s value. Applied to the TcxCalcEdit, TcxCurrencyEdit, TcxDateEdit or TcxTimeEdit component, this shortcut will also set the component’s EditValue property to Null. For the TcxRadioGroup component, pressing this shortcut also sets the ItemIndex property to -1.

Property Value

An integer value that corresponds to the desired shortcut. The default value is 0, which means that no shortcut is assigned.

Note: At design time you specify the shortcut by selecting it from the drop-down list in the Properties window.

At run time, you specify the shortcut by assigning the appropriate integer value to the ClickKey property. See the Remarks section for more information on assigning shortcuts.

Remarks

In scripts, the shortcuts are presented by two-byte integer values having the following format:

Shortcut Format

The key code area is the virtual-key code of the desired key. To specify virtual-key codes of some keys, you can use VK_xxxx Win32 constants: VK_RETURN, VK_NEXT, VK_UP and so on. The available VK_xxxx constants are listed under the Win32API node in the Code Completion window.

The control-key code area specifies whether the key should be used with the Ctrl, Shift or Alt keys. This area can contain any combination of the following values:

Value Key
1 The Shift key.
2 The Alt key.
4 The Ctrl key.

You can combine these constants using the + operator to specify the combination of the control keys. If the control-key code area contains 0, this means no control key is used.

Example

The following sample code demonstrates how you can specify the shortcut at run time:

JavaScript, JScript

// Setting Ctrl+A
 
// Preparing the control-key code.
// It is the Ctrl constant moved 12 bits to the left.
CtrlKeyCode = 4 << 12;
// Assigning the shortcut
UserForms.UserForm1.cxTextEdit1.Properties.ClearKey = CtrlKeyCode + 0x41; // Ctrl+A

Python

# Setting Ctrl+A

# Preparing the control-key code.
# It is the Ctrl constant moved 12 bits to the left.
CtrlKeyCode = 4 << 12
# Assigning the shortcut
UserForms.UserForm1.cxTextEdit1.Properties.ClearKey = CtrlKeyCode + 0x41 # Ctrl+A

VBScript

' Setting Ctrl+A
 
' Preparing the control-key code.
' It is the Ctrl constant moved 12 bits to the left.
CtrlKeyCode = 4 * 4096
' Assigning the shortcut
UserForms.UserForm1.cxTextEdit1.Properties.ClearKey = CtrlKeyCode + &H41 ' Ctrl+A

DelphiScript

// Setting Ctrl+A
var
  CtrlKeyCode : OleVariant;
begin
  // Preparing the control-key code.
  // It is the Ctrl constant moved 12 bits to the left.
  CtrlKeyCode := 4 shl 12;
  // Assigning the shortcut
  UserForms.UserForm1.cxTextEdit1.Properties.ClearKey := CtrlKeyCode + $41; // Ctrl+A
end;

C++Script, C#Script

// Setting Ctrl+A
 
// Preparing the control-key code.
// It is the Ctrl constant moved 12 bits to the left.
CtrlKeyCode = 4 << 12;
// Assigning the shortcut
UserForms["UserForm1"]["cxTextEdit1"]["Properties"]["ClearKey"] = CtrlKeyCode + 0x41; // Ctrl+A

See Also

ClickKey Property

Highlight search results