Multiple Object Interfaces

Some ActiveX controls are designed with multiple (object) interfaces. For example, "Microsoft Chart Control, version 6.0 (OLEDB)" has 42 public interfaces. Each interface is equivalent to a new object definition. In order to access the full feature set of the Microsoft Chart control, ACUCOBOL-GT must allow the property modification and method invocation of 42 different objects. For example, to set the Microsoft Chart legend, you get the value of the Legend property. This value is an object that you may then modify to change the legend. The Legend object has properties whose values are other objects, and so on.

Here's how you would set the text and backdrop parameters for a chart legend in Visual Basic.

Private Sub Command1_Click()
   With MSChart1.Legend
      ' Make Legend Visible.
      .Location.Visible = True
      .Location.LocationType = VtChLocationTypeRight
      ' Set Legend properties.
      .TextLayout.HorzAlignment = _
      VtHorizontalAlignmentRight   ' Right justify.
      ' Use Yellow text.
      .VtFont.VtColor.Set 255, 255, 0
      .Backdrop.Fill.Style = VtFillStyleBrush
      .Backdrop.Fill.Brush.Style = VtBrushStyleSolid
      .Backdrop.Fill.Brush.FillColor.Set 255, 0, 255
   End With
End Sub

In ACUCOBOL-GT this task is accomplished in a similar way with the USE verb, "^" and "::" operators. For example:

MODIFY MS-CHART-1 Legend::Location::Visible = 1.
MODIFY MS-CHART-1 Legend::Location::LocationType =
       VtChLocationTypeRight.
MODIFY MS-CHART-1 Legend::TextLayout::HorzAlignment =
       VtHorizontalAlignmentRight.
MODIFY MS-CHART-1 Legend::VtFont::VtColor::
       Set ( 255, 255, 0 ).
MODIFY MS-CHART-1 Legend::BackDrop::Fill::Style = 
       VtFillStyleBrush.
MODIFY MS-CHART-1 Legend::BackDrop::Fill::Brush::Style = 
       VtBrushStyleSolid.
MODIFY MS-CHART-1 
       Legend::BackDrop::Fill::Brush::FillColor::
             Set ( 255, 0, 255 ).

or:

USE MS-CHART-1 Legend
MODIFY ^Location::Visible = 1
       ^Location::LocationType = VtChLocationTypeRight
       ^TextLayout::HorzAlignment =
              VtHorizontalAlignmentRight
       ^VtFont::VtColor::Set ( 255, 255, 0 )
       ^BackDrop::Fill::Style = 
             VtFillStyleBrush
       ^BackDrop::Fill::Brush::Style = 
             VtBrushStyleSolid
       ^BackDrop::Fill::Brush::FillColor::
             Set ( 255, 0, 255 )
END-USE

This syntax can be described as follows. In this format, the word following MODIFY must always be a control handle or "^". Each property or method name can be followed by "::" and then another property or method name to invoke methods inline. "MethodName1::MethodName2" means invoke the method "MethodName1" of the current object and set the current object to the return value. When a property or method name is followed by a token other than '::', then it means to actually invoke the method on the current object passing the specified arguments or set the property to the specified value and reset the current object to null.

For example, the following code:

MODIFY MS-CHART-1 
       Legend::BackDrop::Fill::Brush::FillColor::
             Set ( 255, 0, 255 ).

can be broken down as follows:

MODIFY
MS-CHART-1 
Legend
::
BackDrop
::
Fill
::
Brush
::
FillColor
::
Set
( 255, 0, 255 ).

which means MODIFY MS-CHART-1 in the following ways:

  1. Set the current object to the chart control.
  2. Invoke the "Legend" method of the current object (the chart control).
  3. Release the current object.
  4. Set the current object to the value returned by Legend.
  5. Invoke the "BackDrop" method of the current object (the Legend object).
  6. Release the current object.
  7. Set the current object to the value returned by BackDrop.
  8. Invoke the "Fill" method of the current object (the BackDrop object).
  9. Release the current object.
  10. Set the current object to the value returned by Fill.
  11. Invoke the "Brush" method of the current object (the Fill object).
  12. Release the current object.
  13. Set the current object to the value returned by Brush.
  14. Invoke the "FillColor" method of the current object (the Brush object).
  15. Release the current object.
  16. Set the current object to the value returned by FillColor.
  17. Invoke the "Set" method of the current object (the FillColor object) passing ( 255, 0, 255 ) as arguments.
  18. Release the current object.