| **Navigation:**  [[introduction.htm|Language Reference]] > App A - DDE, OLE, and OCX > Calling OLE Object Methods >====== Method Syntax Overview ====== | [[calling ole object methods.htm|{{btn_prev_n.gif|Previous page}}]][[introduction.htm|{{btn_home_n.gif|Return to chapter overview}}]][[parameter passing to ole ocx methods.htm|{{btn_next_n.gif|Next page}}]] | | || To call any OLE/OCX method, you use Clarion's Property Syntax. You specify the control to which the method or property belongs as the field equate label of the OLE control, then write the method call in a string constant inside the curly braces ({}). 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**__ Many OLE/OCX code examples use the VB //With ... End With// structure to associate multiple property assignments and/or method calls with a single object. In this case, the object is named in the //With// statement and all the property assignments and method calls within the structure begin with the dot separator, then the name of the property to set or method to call. For example, the following VB code: **  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**