Setting or Activating a Key

For cloned controls, the clone and the children controls of the cloned control can be referenced by their Key property. When you create event link connections between controls in an automation, Studio displays a key parameter on control design blocks whenever a context exists. Here, the term context defines any instance of an target for which multiple instances can be created. The creation of keys and the setting of keys for objects is governed by the existence of contexts as follows.

To assign a key, use either the Key property for the control or the ActivateOrSetNextKey method for the object. Normally you use the Created event to set the Key property. This makes sure the correct key is assigned to the corresponding control instance since the Created event is on the same thread used to set the Key property. Here is an example of the Key property.

The Key property accepts String input for the key. Here is an example of the ActivateOrSetNextKey method.

The ActivateOrSetNextKey method accepts one parameter (key). If a window is open that has that key already assigned, this method activates that window. If not, the method assigns that key to the next window of the correct typed opened.


Related information

Handle KeyNotFoundException

Identifying Targets on MDI Child Windows

Using the Upstream Key/Override Key


Privacy | Trademarks | Terms of Use | Feedback

Updated: 18 June 2020

© 2016 - 2020 Pegasystems Inc.  Cambridge, MA All rights reserved.


OpenSpan data classification label