COM Control |
The PxPlus COM Control Properties dialogue allows you to integrate external components produced by third-party vendors into your MS Windows-based PxPlus application (e.g. progress bar, spreadsheet, browser or calendar). This dialogue is used to obtain information about, as well as access to, the internal properties and methods of the Component Object Model (COM) control being used. These types of controls are now typically based on Windows ActiveX vs. the older OLE control technology (OCX).
To add a COM control to a NOMADS panel, see Adding a COM Control.
To define a COM control once it has been added to a panel, see Defining a COM Control.
For information on handling events for a COM control, see Handling Events.
To add a COM control to your panel, select the COM Control button from the Controls Toolbar in the Panel Designer. Hold down the left mouse button and drag the mouse to create a rectangle to the desired size. Release the mouse button to create the new object. Define the properties for the new COM control.
For making other adjustments, see Modifying Objects.
When creating or editing a COM Control, the COM Control Properties dialogue is displayed:
This dialogue is divided into the following tabbed panels for viewing and/or changing COM control properties: Display, Properties and Logic.
Object Name |
Unique name of the control (NOMADS provides a default). Naming conventions for variables apply. Note: | ||||||
COM Control |
Unique name of the COM control. Click the Query button for a list of available selections:
(The Chromium Browser Object was added in PxPlus 2017.) | ||||||
Alternate control names to load at runtime if primary not found |
Assign alternate COM control names (separated by semi-colons) to be used at runtime if the generic name cannot be found. | ||||||
Position |
(Support for increased Column and Line maximums was added in PxPlus 2021.) | ||||||
Size |
(Support for increased Width and Height maximums was added in PxPlus 2021.) | ||||||
Objects |
Assign property/method values (Fixed or Expression) and set up logic that will execute when a COM control event is triggered. See Defining a COM Control. | ||||||
Default Program |
Displays the name of the Default Program used in the Panel Header definition. (The Default Program was added for display in PxPlus 2019.) | ||||||
Post Create |
Logic to be processed after the control is drawn. Click the drop-down arrow for a list of selections. See Events Logic. Click the Program Logic button beside the Perform or Call action to launch the default program editor, which is typically the *IT - Integrated Toolkit. To make Ed+ the default program editor, change the setting for the %NOMADS'Program_Editor property to Ed+. (The ability to set Ed+ as the default program editor was added in PxPlus 2023.) | ||||||
| |||||||
Groups |
Button used to assign the control to a group. See Group Assignment. | ||||||
Notes |
Add notes/comments for the control. Maximum 1024 characters. These notes also display in the Wiki Help documentation for the panel. See NOMADS Wiki Help. (The Notes button was added in PxPlus 2023.) |
After a COM control is created on the panel (see Adding a COM Control), the control's properties need to be defined.
The steps to define a new COM control are listed below. (These steps are based on the Folder Style version of the NOMADS Panel Designer.)
Step |
Description | ||||||||||||||||
1. Select a COM Control |
In the COM Control Properties dialogue, click the Query button for the COM Control property. Available selections are Chromium Browser, ActiveX Controls, PVX Plus Controls. | ||||||||||||||||
2. Define Properties |
Once the COM Control is selected, assign property/method values using the Properties tab. The Item grid lists all the sub-objects, properties and methods for the COM control selected. This grid consists of the following:
| ||||||||||||||||
3. Define Events |
The Events grid contains all the events available for the COM control. This grid consists of the following:
| ||||||||||||||||
4. Assign Post Create Logic |
Add/edit Post Create logic using the Logic tab. Enter the program/entry point to be performed, called or executed after the COM control is created. See Events Logic. |
It is strongly recommended that event functions be kept relatively short and simple. One reason for this is that normal code execution will be suspended when an event is handled and will not resume until the event function is finished. It is also possible to introduce code (or use commands, such as MSGBOX) to create a re-entrance issue in the event function.
How NOMADS Handles the Events
COM controls generate a unique CTL value for each event defined in NOMADS. NOMADS reserves CTL values between 22001 and 22999. These are loaded into a table at run time after the COM is created using:
ON EVENT "event_name" FROM COM_id PREINPUT CTL_value
Working with Events that Supply Parameters
Most of the time, it is sufficient to trap events through the COM interface. However, NOMADS does not normally receive the parameters that may be passed back (if the events are capable).
To receive event parameters from a COM control, a PxPlus class must first be designed. A class function must be written for each event to be handled.
Example:
If you were writing an event class for the COM object Shell.Explorer.2, you could receive parameters from the exposed event BEFORENAVIGATE2 (URL, [Flags], [TargetFrameName], [PostData], [Headers]) by defining a class as follows:
def class "menuevent"
property TXID$
function BEFORENAVIGATE2(*)BEFORE for event "BeforeNavigate2"
end def
BEFORE:
enter *,U$,*,*,*,*,C
if mid(lcs(U$),1,3)="tx:" \
then C=1;
TXID$=U$(4) \
else TXID$=""
return 1
The function and label name are not required to match the name of the event. It is the string after the FOR EVENT portion of the statement that determines the event name that will be handled. The event name is not case sensitive, and argument names are not required to match the COM control's event declaration. When the OOP method name matches the COM event name, then SAME can be used to describe the name of the event.
Once the class is complete, an instance of the class must be instantiated to bind the COM object to the event handler. In NOMADS, this code should be invoked by the COM Post Create logic:
create_object:
EVNTOBJ=new("menuevent",EXPLORER.CTL,100)
return
Once bound, the PxPlus event class function will be called when the corresponding event occurs.
TinyMCE® is a registered trademark of Tiny Technologies Inc.