ActiveX and ROM With a View

HOW DOES ROM WITH A VIEW USE ACTIVEX ?

ActiveX Control Object
ActiveX Control Wizard
Including ActiveX Controls on the CD
Adding or Changing a Property of an ActiveX Control
Using Object Events to Call ActiveX Methods
Using Return Values with ActiveX Controls
Adding Function to an ActiveX Control

ACTIVEX CONTROL OBJECT

There several methods available to insert an ActiveX Control. A brief wizard will assist in defining specific properties of an ActiveX Control.

The two following methods will bring up the Insert Object Wizard with the first page asking what type of Object is being inserted:

  • In the Treeview or Page Editor, right-click on the Page and select New, then Object.
  • In the Treeview or Page Editor, if there are already Objects: right-click the Object, select New , then Object.

Select ActiveX Control, click Next. The Add an ActiveX Control pages will appear. The two following methods will skip the first page of the Insert Object Wizard:

  • From the Menu Bar, click the Insert Menu, and select Insert ActiveX Control.
  • From the Toolbar, single click the image that highlights as Insert ActiveX Control.

ACTIVEX CONTROL WIZARD

The first page of the Wizard asks what ActiveX Control is to be inserted. The list generated includes the ROM With a View suite of ActiveX Controls as well as any registered ActiveX Controls on your WIN 95/98 machine. Any of these ActiveX Controls can be easily incorporated into a project.

To select an ActiveX: scroll through the generated list or use the Find button to browse. When an ActiveX is selected, the location and Class ID of the control will appear in the lower right corner of the Wizard page.

After selecting the ActiveX Control to be inserted, click Finished. The ActiveX Control will appear on the Treeview; on the Page Editor the Control is displayed as a gray rectangle in the upper left corner (0,0). To reposition the Control click and drag it to the desired location; to resize the control, click a corner or edge and drag to create the desired size.

Once the ActiveX Control has been added, the next step is to insert the appropriate Events, Methods, and Properties to enable the Control to function.

The more familiar one is with the ActiveX Control being used, the easier it is to use its Methods, Properties, and Events.


INCLUDING ACTIVEX CONTROLS ON THE CD

In order for an ActiveX Control in a ROM With a View application to work on the end user’s computer, the ActiveX Control must exist and be registered on that computer. In the event that a ROM With a View application encounters a requirement for an ActiveX Control that the computer does not have, the application will simply ignore the command and proceed to the next step.

A ROM With a View application using ActiveX Controls requires the following:

  • Knowledge of the ActiveX Control(s) being used in the application (name of Control, the class ID, and the version number)
  • The ability to check the end user’s computer for the ActiveX Control(s) being used
  • The ability to write any missing ActiveX Control(s) to the end user’s Hard Drive
  • The ability to register the new ActiveX Control(s) added to the Hard Drive

Note: Some ActiveX Controls may have licensing requirements and involve entries in the System Registry. Licensed controls usually come with setup programs that take care of these details. The redistribution rights, proper installation, and registration of the ActiveX Controls are the responsibility of you, the author. Refer to the author or publisher of the ActiveX Control to insure correct installation and use.

The inclusion of this information in a ROM With a View application is easily done with a utility [Makecab] included with the ROM With a View program. This .cab file includes an .inf which will automatically check the end user’s computer for the above information and take care of writing and registering any ActiveX Control(s) that are found to be missing. This can also be done manually.


ADDING OR CHANGING A PROPERTY OF AN ACTIVEX CONTROL

Changing the Property of a Control is accomplished by adding a Set Property ScriptItem to an Event.

Right-click the Event, select New, then select ScriptItem. The ScriptItems page will appear, select SetProperty, click OK.

On the SetProperty page use the drop down arrow to find the ActiveX Control to be modified. Once the Control is selected, click the Change Property button.

A Property page for the ActiveX Control will appear; this page has four fields to fill out: Object, Property, Variable, and New Value.

 

OBJECT
This is the Object whose property is being changed.
Note: The ActiveX Control selected on the previous screen will be highlighted in this line.

PROPERTY
This is the property to be changed. Clicking the down arrow will show a list of the properties applicable to the object selected in the Object line.
Note: To the left of the Property line is a box that will display the variable type of the selected Property.

VARIABLE
If the selected Property is to be modified by a variable, select the variable.
Note:
If no variables have been created, this line will be grayed out.
Note: To the left of the Variable line is a box that will display the variable type of the selected Variable.

NEW VALUE
This is the new value of the Property being changed.
Note:
The new value variable type must agree with the variable type shown in the box to the left of the selected Property.

 

Set the fields, click OK. 
A SetProperty ScriptItem will appear below the Event.


USING OBJECT EVENTS TO CALL ACTIVEX METHODS

Any Object (Button, Image, Text) can be used to trigger an ActiveX Control.

Adding the appropriate ScriptItem to the Object’s Event [Call ActiveX Method or Set Property]  will enable the Object to trigger the ActiveX Control.


USING RETURN VALUES WITH ACTIVEX CONTROLS

In order for a Return Value to be of use, there must be notification that the Return Value was received and recognized. This can be done by creating a variable to which the Return Value is written when a specific Method is called. Once the information is received and written to a variable, the information can then be utilized by the Global Event OnChange. OnChange can be scripted to look for a specific change (the new value of the variable) and when found, perform the desired tasks.

The first step is to create the variable. This is done by using the ScriptItem, Create Variable.

Note: We recommend that the variable types of the Return Value and the Variable agree

Once you have created the variable, add the corresponding Property or Method to receive the Return Value. On the Call ActiveX Method ScriptItem page is a dialog box to designate the name of the variable to write a Return Value. Select the Method to be called; select the variable to write the Return Value; click Ok. You can add additional script items as you choose.

Now the OnChange event can be scripted to perform a task based upon the Return Value of the ActiveX Control. To make use of the OnChange Event the following must be added to the event:

The Property or Method of the ActiveX Control whose change is being monitored.

The comparison Item or Variable.

The Script(s) of what will happen when the change occurs.


THE BASICS OF ADDING FUNCTION TO AN ACTIVEX CONTROL

Depending on the ActiveX Control being used, Methods, Properties, and Events will need to be added in order for the Control to work properly.

To Add an Event to an ActiveX Control:
Right-click the ActiveX and select New, then select Event. The Add Events page will appear with a list of all the events specific to the ActiveX Control. This list is generated by the program querying the ActiveX Control and the Control answering with what it is capable of doing. This list can vary from a few events to a very long list. An example of a control with many Events is the Microsoft Office Spreadsheet ActiveX.

Select the Event to add, click OK.

The Event will appear on the Treeview below the ActiveX Control.

To enable the Event one or more ScriptItems will need to be added. The types of ScriptItems generally added are: Call ActiveX Method, and SetProperty.

To Add a Method to an ActiveX Control:
A Method is called by adding the ScriptItem Call ActiveX Method to an Event of the Control. Right-click the Event that will call the Method and select New, then select ScriptItem. The ScriptItems page will appear, select Call ActiveX Method, click OK. The Call ActiveX Method Properties page will appear.

On the left is a drop down list containing all the ActiveX Controls on the current page of the project. Select the ActiveX Control for which the Method is being called. Once the Control is selected, the list to the right will present the corresponding Methods available for that Control. When the Method is selected, the known parameters of the Method will appear in the box to the left of the list.

If a Parameter needs to be designated for the Method, click the Parameter tab.

If a Return Value is associated with the Method being called, the Return Value tab will appear.

To designate the variable for writing of the Return Value, click the tab and select the variable to be used.

Once the Method, Parameter(s), and or Return Values are designated, click OK.

The CallActiveXMethod ScriptItem will appear below the Event to which it was added.

Note: A Call ActiveX Method ScriptItem can be associated with any type of Event on any type of Object. The Event does not have to be an ActiveX Control, any Objects’ Events can Call an ActiveX Method and trigger the Control.

 

Moon Valley Software