Automation and the Container

The key element for notifying the user of automation events is the container. The primary purpose of the container is to automate drawing, as well as automate the collection and transformation of coordinates of objects within the container. Consequently, it is very important to understand the Container before using Automation.

Every window opened in an automation application should have a container associated with it. First, the container is initialized by calling LContainer::Initialize. The container is then created and associated with a specified window using LContainer::Create. Once the container has been initialized, created and associated with a window, it can be added to the list of containers for a specific automation handle. The automation handle must be initialized and created by calling LAutomation::Initialize and LAutomation::Create. Once the automation handle has been initialized and created, a container can be added to the automation list of containers using LAutomation::AddContainer. At this point, all automation functionality is associated with the container and the window that owns the container. All synchronization and data handling between the container and the automation handle will be done automatically.

The automation maintains a list of added containers. Therefore, the user must inform the automation of any changes made to a container that exists in the automation container list. Since an automation handle may have multiple containers associated with it, there must be a way to indicate which container is active. The active container is set by calling LAutomation::SetActiveContainer. While a container is active, all automation functions act on this container. To perform some automation function on another container, that container must be set as the active container. To determine which container is the active container, call LAutomation::GetActiveContainer.

With many containers associated with a single automation handle, it is occasionally necessary to enumerate the associated containers. LAutomation::EnumContainers enumerates all containers associated with the specified automation handle. For each container enumerated by LAutomation::EnumContainers, an LAutomation::EnumContainersCallBackfunction gets called. This allows for further processing of each enumerated container.

The user can issue any command to a container through the container handle. Therefore, it is important to remember that the same container handle is used internally by the automation.

When the window that owns a container is closed, the container should be removed from the list of automation containers using LAutomation::RemoveContainer. After the container is removed from the automation container list, the container handle should be freed using LContainer::Free.

Help Version 20.0.2020.4.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Container and Automation C++ Class Library Help