DEV Community

zuUwn21
zuUwn21

Posted on

🚀 Uniface 10.4: Introduction to the activate Statement

✨ What is the activate Statement?
The activate statement is a central element in Uniface for executing operations on component instances. It allows you to specifically call functions (operations) of a component at runtime—whether synchronously, asynchronously, stateless, or with special parameters.

Whether you want to start a form, call a service, or exchange data between components: activate is the key to flexible and dynamic control of your Uniface applications.

🛠️ Basic Syntax
The syntax of activate is flexible and powerful. Here is the basic pattern:

activate {/list | /sync | /async} { /stateless}
InstanceName{.OperationName (ArgumentList)}
Enter fullscreen mode Exit fullscreen mode

InstanceName: Name of the component instance on which the operation is executed.

OperationName (optional): Name of the operation to be executed. If nothing is specified, .exec() is used by default.

ArgumentList (optional): Comma-separated list of arguments for the operation.

📦 Simple Practical Examples
1️⃣ Execute the Standard Operation on a Component

activate "MyCpt1"

Starts the standard operation (exec) of the component MyCpt1. If the instance does not yet exist, it is automatically created.

2️⃣ Call a Specific Operation with Parameters

activate "MyCpt1".do_it(42, "Test")

Calls the operation do_it on the instance MyCpt1 with the parameters 42 and "Test".

3️⃣ Instance is Automatically Created
If you address an instance with activate that does not yet exist, it is automatically created—without the need for an explicit newinstance command. This makes activate especially flexible and easy to use.

🧑‍💻 When and Why Should You Use activate?
Dynamically Start Components: You can flexibly call components and their operations at runtime.

Parameter Passing: Arguments can be specifically passed to operations.

Automatic Instance Creation: No separate newinstance needed; activate handles this for you.

Error Handling: You can respond to the result of the operation via return values and error codes.

Note: This post was created with the support of AI and based on the official Uniface 10.4 documentation. For further details, please refer to the original documentation.

Questions, suggestions, or your own activate tips? Feel free to share them in the comments! 👇

Top comments (0)