Progress
AppBuilder
Developer’s Guide


Configuring an ActiveX Combo Box Instance

ActiveX (OCX) objects are functionally similar to native Progress objects, but written to the Component Object Model (COM) standard defined by Microsoft. To adapt them for use in the Progress environment, AppBuilder automatically supplies a two-layer interface object, the Control Frame. Control Frames translate between the COM world and the 4GL world.

When you select an ActiveX (OCX) object and choose Tools Property Sheet, the dialog box that opens in response displays the few properties belonging to the 4GL layer of the Control Frame. See the "ActiveX Control Frame Properties" section in "Frequently Used Dialogs," for further information.

To open the properties dialog box for the Combo Box itself, double-click on the object. The special ActiveX-style properties dialog box opens:

References in your code to the native ActiveX properties of the Combo Box instance must take the indirect form Com-Handle:ActiveX-Identifier:Property-Identifier.

Minimal Configuration

While you can accept many of the default settings, you will need to make some changes:

To populate the list of choices, follow these steps:

  1. Click in the [Custom] property data field to expose the ellipsis button, then choose the button to open the Custom Properties dialog box:
  2. Click on the Contents tab to expose that field:
  3. Type in this Combo Box’s list of items, one item per line. When finished, choose OK to close the dialog box.

Additional Property Configuration

Choose from three different styles:

Code Configuration

When you run a workspace for the first time after placing your first ActiveX (OCX) object in it, AppBuilder creates the control_load procedure. You can inspect that procedure in the Section Editor, but not edit it.

In that procedure, AppBuilder creates the variable of type COM–HANDLE that you will use when you write event handlers. The identifier of the variable is the same as the identifier you assign to the Control Frame’s Object field, with “ch” prepended. Thus, if you assign the identifier Example to the Control Frame, the COM–HANDLE identifier will be chExample.

The Combo Box stores its current string value in the Value property. To determine the index value of that string (the topmost list item is index 0), pass the Value property to the FindStringExact() method. Presuming you use the Object identifier Example for the OCX Control Frame, this toy code will detect the user’s selection, and print out the string and index values:

/*
**  Add to the Definitions section
*/

DEFINE VARIABLE sSelection AS CHARACTER INITIAL "".
DEFINE VARIABLE iSelection AS INTEGER INITIAL 0.

/*
**  Add as the Trigger for event OCX.Click
*/

ASSIGN
  sSelection = chExample:CSComboBox:Value
  iSelection = chExample:CSComboBox:FindStringExact( sSelection, -1 ).
MESSAGE "Selection is " sSelection "at index" iSelection . 

For further information about events, methods, and properties for the three OCX objects that AppBuilder supplies in the Objects Palette, see the online help.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095