Using ActiveX Controls

In this section:

How to:

Reference:

You can use ActiveX controls in your forms. ActiveX controls are compiled software components that provide a set of business or user interface functions. They can extend the functionality of your applications.

ActiveX controls are included in your project as resources. Resources are part of your project, but you do not create or edit them directly using the Maintain Development Environment. However, WebFOCUS Maintain will take care of deploying them to the correct location so that your application will run properly.

When you place an ActiveX control on your form, the property sheet for that control gains an extra tab: the ActiveX tab. The properties in this tab determine the behavior of your ActiveX control. Use JavaScript or VBScript for your Maintain procedure to access these properties.

Depending on the security settings of your end users browsers, ActiveX controls may be disabled. (For example, to change your security settings for Internet Explorer 5, in the Tools menu, click Internet Options, then click the Security tab, and click Custom Level. You will see a Security Settings dialog box where you can enable or disable various features, including ActiveX controls.)


Top of page

x
Procedure: How to Place an ActiveX Control on Your Form
  1. Select the ActiveX control Activex control button in the Controls palette.
  2. Draw a rectangle on your form approximately where you want your ActiveX control to be at approximately the size you want.
  3. If you have no ActiveX controls as resources in your project, WebFOCUS Maintain opens the Resource Wizard, where you can add one as a resource. For more information, see How to Add an ActiveX Control to Your Project as a Resource. When you finish adding your ActiveX control to the project, WebFOCUS Maintain will display it in the Insert ActiveX Control Resource dialog box.

    If you have ActiveX controls as resources in your project, WebFOCUS Maintain will display the Insert ActiveX Control Resource dialog box.

  4. Select the ActiveX control you want to use and click OK.
  5. Give your ActiveX control a more meaningful name than the default one. This is optional, but recommended.
  6. If necessary, readjust the size and placement of your ActiveX control.
  7. To change any properties specific to the ActiveX control, click the ActiveX tab in the property sheet.

Top of page

x
Procedure: How to Add an ActiveX Control to Your Project as a Resource
  1. If you have no ActiveX controls in your project, use the ActiveX control Activex control button in the Form Editor to add an ActiveX control to your form.

    or

    In the Insert ActiveX Control Resource dialog box, click Create a new ActiveX control resource.

    WebFOCUS Maintain opens the Resource Wizard, a series of windows that guide you through adding an ActiveX control to your project.

  2. Click Browse for registered controls on My Computer.
  3. Select an ActiveX control in the Insert ActiveX Control dialog box and click OK.

    You will return to the Resource Wizard with the ActiveX control name and location listed.

  4. Click Next.
  5. Specify a unique name for your ActiveX control, then click Finish.
  6. You may see a dialog box informing you that WebFOCUS Maintain needs to make a copy of the ActiveX control in the project directory. Click OK.

Top of page

x
Syntax: How to Pass the Value of an ActiveX Control Property to a Maintain Function

To use the value of an ActiveX Control property in a Maintain function, use JavaScript or VBScript to retrieve it. In an event handler for an ActiveX control event, use a script function for the handler and then call the Maintain function using IWCTrigger. For more information on IWCTrigger, see How to Use the IWCTrigger Function to Call a Maintain Function From Your Script Handler.

IWCTrigger ("MaintainFunction",document.form.control.property);

where:

MaintainFunction

Is the name of the Maintain function you are calling.

form

Is the name of the form the ActiveX control is on.

control

Is the name of the ActiveX control.

property

Is the name of the ActiveX control property (look for ActiveX control properties in the ActiveX tab of the property sheet for the ActiveX control).



Example: Passing an ActiveX Control Value to a Maintain Function

If you have an ActiveX calendar control on Form1 which has a property called Month, you can use IWCTrigger to send the value of Month to a Maintain function called UpdateDate, using either JavaScript or VBScript:

IWCTrigger("UpdateDate",document.Form1.CalendarControl.Month);

Top of page

x
Reference: Insert ActiveX Control Dialog Box

You use the Insert ActiveX Control dialog box to select an ActiveX control to include as a resource in your project.

Insert Activex Control dialog box

This dialog box contains the following elements:

Select a Control Type:

Contains a list of the supported ActiveX controls available on your machine.

Refresh

Tells WebFOCUS Maintain to update the list of ActiveX controls when you add a new one to your machine.


Top of page

x
Reference: Insert ActiveX Control Resource

You use the Insert ActiveX Control Resource dialog box to select which ActiveX resource to insert into your form.

Insert Activex Control Resource  dialog box

This dialog box has the following elements:

Select an ActiveX control resource

Lists the available ActiveX control resources in your project.

Create a new ActiveX control resource

Opens the Resource Wizard, where you can add a new ActiveX control to your project.


Top of page

x
Changing ActiveX Control Properties

When you select your ActiveX control, you will see a list of ActiveX control properties in the property sheet. Changing these properties will change what your ActiveX control looks like and what it does at run time.

Many of the styling properties can also be changed using a Cascading Style Sheet. For more information on Cascading Style Sheets, see Using Cascading Style Sheets.

An ActiveX control also contains an ActiveX tab in the property sheet that contains more properties that are specific to the control. For more information on these properties, see the documentation that accompanied the control.

Choose your property based on the task you wish to perform:

If you want to change the name of the ActiveX control that identifies it to the procedure, use the (Name) Property. For more information, see the (Name) Property.

If you want to change the size of the location or size of the ActiveX control, use a style sheet or resize the ActiveX directly in the form. You can also use the Bottom Property, Left Property, Right Property, and Top Property.

If you want to make the ActiveX control inactive or make it invisible, use the Enabled Property to determine whether the ActiveX control is active or not. If the ActiveX control is inactive, nothing will happen when the end user clicks it. You can also use the Visible Property to determine whether the ActiveX control is visible to the end user or use a style sheet. For information, see the Enabled Property and the Visible Property.

If you want to change what the cursor looks like when it is on top of the ActiveX control, use the CursorPointer Property or use a style sheet.

If you want to display a tooltip when the cursor is on the top of the ActiveX control, use the ToolTipText Property.

If you want to assign a help topic to the ActiveX control, use the Help Property. For more information, see Assigning Help to Your Forms and Controls.

If you want the end user to be able to tab to the ActiveX control, use the Tabstop Property.

If you want to move the text to another layer, use the Layer Property. For more information, see Layering Controls.


Top of page

x
Unstable ActiveX Controls

Occasionally, you may have unstable ActiveX controls on your computer that have been installed with other software or downloaded from the web. If your computer has any unstable ActiveX controls, when you first generate the list of available controls for the Insert ActiveX control dialog box or when you refresh the list, a control may cause the Maintain Development Environment to crash while it is reading the control. However, from that point on, WebFOCUS Maintain will keep a list of any unstable ActiveX controls in the registry and will no longer try to load them into the list. Therefore, you will never crash more than once over the same unstable control.

Note: The only way to take a control off of the black list is to delete it from the registry.


WebFOCUS