Clarion Calling OLE Method
Method Syntax Overview The example code supplied with most OLE controls uses the VB/C++ "dot property" syntax to specify the name of the control and the method to call or the property to set. For example, the following VB code: ControlName.AboutBox translates to Clarion as: ?Ole{'AboutBox'} This code displays the "About" dialog for the ControlName control. You might also see this example's VB code as: Form1.ControlName.AboutBox This form simply specifies the dialog containing the ControlName object. The Clarion translation for this is still the same. The OLE/OCX object is always referenced in Clarion code by the field equate label of the Clarion OLE control, no matter what the name of the control is in VB, because the object's registered name is specified in the CREATE or OPEN attribute of the OLE control. Therefore, the Clarion runtime library only needs to know the field equate label to know exactly which object is being referenced. Translating VB's "With" Syntax With Form1.VtChart1 'displays a 3d chart with 8 columns and 8 rows data .chartType = VtChChartType3dBar .columnCount = 8 .rowCount = 8 For column = 1 To 8 For row = 1 To 8 .column = column .row = row .Data = row * 10 Next row Next column 'use the chart as the backdrop of the legend .ShowLegend = True End With translates to Clarion as: ! displays a 3d chart with 8 columns and 8 rows data ?Ole{'chartType'} = VtChChartType3dBar ?Ole{'columnCount'} = 8 ?Ole{'rowCount'} = 8 LOOP column# = 1 TO 8 LOOP row# = 1 TO 8 ?Ole{'column'} = column# ?Ole{'row'} = row# ?Ole{'Data'} = row# * 10 END END ! use the chart as the backdrop of the legend ?Ole{'ShowLegend'} = True Since Clarion has no direct equivalent to the VB With ... End With structure, you just explicitly name the OLE control's field equate label on each property assignment or method call. The single quote (') in VB code indicates a comment. VB allows nesting these With ... End With structures, so you may need to "travel" back to find the object's name. This example demonstrates nested VB With structures: With MyObject .Height = 100 ' Same as MyObject.Height = 100. .Caption = "Hello World" ' Same as MyObject.Caption = "Hello World". With .Font .Color = Red ' Same as MyObject.Font.Color = Red. .Bold = True ' Same as MyObject.Font.Bold = True. End With End With which translates to Clarion as: ?Ole{'Height'} = 100 ! MyObject.Height = 100 ?Ole{'Caption'} = 'Hello World' ! MyObject.Caption = "Hello World" ?Ole{'Font.Color'} = Red ! MyObject.Font.Color = Red ?Ole{'Font.Bold'} = True ! MyObject.Font.Bold = True |

