Containers for ActiveX controls
This topic includes the following sections:
- Using a single control with a Toolkit container
- Using multiple controls with a single container
- Creating a container for the Spread control
- Using an ActiveX Toolkit list
To use an ActiveX control with a UI Toolkit application, you’ll need two types of containers for the control: a Toolkit container window and an ActiveX container. Toolkit includes routines that create these containers, load ActiveX controls, and retrieve the IDs for ActiveX containers.
The Toolkit container window is a Toolkit window that you can manipulate as you would any other Toolkit window (environment control, place/remove, and so forth). The ActiveX container is placed within the Toolkit window and is exactly the same size as the Toolkit window. This container is “slaved” to the Toolkit container window, so you won’t manipulate it directly. The %AX_TKCID enables you to get the ActiveX container ID, and you can also get this ID by passing the optional ax_container_id argument to %AX_TKWIN. You will need this ID if you want to bind to the ActiveX container’s events or if you want to manipulate the ActiveX container’s properties. (See Extended properties, Ambient properties, and Local properties.)
Using a single control with a Toolkit container
The most common way to use ActiveX controls with a Toolkit application is to use a single ActiveX control with a single Toolkit container window (and a single ActiveX container). To do this, use the following routines, which are designed for this scenario and are easier to use than ActiveX API counterparts. These routines are documented in Routines for ActiveX controls in Toolkit containers unless otherwise noted.
- To create a Toolkit container and an ActiveX container and load the ActiveX control, use %AX_TKSINGLE. This routine returns an ID for the Toolkit container window, registers a method set for the window, and enables you to extend the method set with your own routines.
- To retrieve the ActiveX control ID, pass the Toolkit container ID to %AX_TKCTLID.
- To retrieve the ActiveX container ID, pass the Toolkit container ID to %AX_TKCID.
- To trigger an event for the Toolkit container window, use the D_SIGNAL subfunction of %U_WNDEVENTS.
- To use the Toolkit container window ID to access the properties and methods for the ActiveX control, use %AX_TKCALL, AX_TKGET, %AX_TKGETINT, or AX_TKSET.
- To use the ActiveX container ID to access the properties and methods for the ActiveX container, use the %AX_CALL, AX_GET, %AX_GETINT, or AX_SET routine in the Synergy ActiveX API.
- To control how keystrokes are passed to the ActiveX control, use AX_WANTSKEY.
- To wait for user input for the ActiveX control, use AX_INPUT.
You can also use the method documented in Using multiple controls with a single container below, and load only one control into the container. However, we recommend using %AX_TKSINGLE when working with a single control because it minimizes the number of separate IDs that need to be maintained.
Using multiple controls with a single container
You can use multiple controls with a single Toolkit container window (and a single ActiveX container). Note, however, that with this method, you can’t use the Toolkit container window ID to access properties and methods for an ActiveX control (i.e., you can’t use %AX_TKCALL, AX_TKGET, %AX_TKGETINT, or AX_TKSET). Unless otherwise noted, the following routines are documented in Routines for ActiveX controls in Toolkit containers
To use multiple controls with a single container, use the following routines.
- To create a Toolkit container and an ActiveX container, use %AX_TKWIN. This routine returns an ID for the Toolkit container window.
- To load the ActiveX controls, use %AX_LOAD in the Synergy ActiveX API. The ActiveX control IDs are the return value of this function.
- To retrieve the ActiveX container ID, pass the Toolkit container ID to %AX_TKCID or pass the optional ax_container_id argument to %AX_TKWIN.
- To trigger an event for the Toolkit container window, use the D_SIGNAL subfunction of %U_WNDEVENTS.
- To use the ActiveX control ID or the ActiveX container ID to access the properties and methods for the ActiveX control, use the %AX_CALL, AX_GET, %AX_GETINT, or AX_SET routine in the Synergy ActiveX API.
- To control how keystrokes are passed to an ActiveX control, use AX_WANTSKEY.
- To wait for user input for an ActiveX control, use AX_INPUT.
Creating a container for the Spread control
The Professional Series distribution includes the Spread COM control, which is a full-featured spreadsheet encapsulated in an ActiveX control. To use this control, you’ll treat it as a single control in a Toolkit window as discussed in Using a single control with a Toolkit container. However, instead of using %AX_TKSINGLE to create the containers and load the control, you’ll use %GRID_CREATE.
- To create the Toolkit container, create the ActiveX container, and load the Spread COM control, use %GRID_CREATE. This function returns an ID for the Toolkit container window, registers a method set for the window, and enables you to extend the method set with your own routines.
- To retrieve the ActiveX control ID, pass the Toolkit container ID to %AX_TKCTLID.
- To retrieve the ActiveX container ID, pass the Toolkit container ID to %AX_TKCID.
- To trigger an event for the Toolkit container window, use the D_SIGNAL subfunction of %U_WNDEVENTS.
- To use the Toolkit container window ID to access the properties and methods for the ActiveX control, use the %AX_CALL, AX_GET, %AX_GETINT, and AX_SET routines in the Synergy ActiveX API.
- To use the ActiveX control ID to access the properties and methods for the ActiveX control, use the %AX_CALL, AX_GET, %AX_GETINT, and AX_SET routines in the Synergy ActiveX API.
- To control how keystrokes are passed to the ActiveX control, use AX_WANTSKEY.
- To wait for user input for the ActiveX control, use AX_INPUT.
For information on obtaining the Spread COM control, visit www.grapecity.com. For information on the methods, properties, and events for the Spread COM control, see the Spread documentation.
Using an ActiveX Toolkit list
UI Toolkit includes an ActiveX implementation of the Toolkit list. This implementation wraps some of the functionality of the Spread control, providing an ActiveX list that you can control with Toolkit list routines. Your code creates an ActiveX Toolkit list on Windows platforms and a standard Toolkit list on UNIX and OpenVMS. For information, see Defining lists.
In addition to the Toolkit list routines, you can also access published properties and methods for the ActiveX list. For information, see Using lists in Toolkit applications.