


The following section pertains only to ActiveX controls.
All ACUCOBOL-GT controls have properties and styles. In addition to properties and styles, ActiveX controls have a concept known as "methods." In ActiveX, methods (also known as object methods) specify the functions that the control provides. To invoke (call) a method, you use the MODIFY verb in much the same way as you set a property or style.
For example consider the ActiveX control, "Microsoft Rich Textbox Control 6.0". Here is an excerpt from its copy book, created using the AXDEFGEN utility. (See section 6.10 of Book 1, "User's Guide" for more information on using AXDEFGEN):
...
* LoadSave constants.
* LoadSaveConstants
CLASS @LoadSaveConstants
CLSID, 9FAEAB20-894B-11CE-9576-0020AF039CA3
NAME, "LoadSaveConstants"
* long rtfRTF
ENUMERATOR, @rtfRtf, 0
* long rtfText
ENUMERATOR, @rtfText, 1
...
* Microsoft Rich Textbox Control 6.0
*** Primary Interface ***
* RichTextBox
CLASS @RichTextBox
CLSID, 3B7C8860-D78F-101B-B9B5-04021C009402
NAME, "RichTextBox"
...
* LoadFile
* Loads an .RTF file or text file into a RichTextBox control.
METHOD, 37, @LoadFile,
"BSTR bstrFilename",
"VARIANT vFileType"
OPTIONAL 1
...
The LoadFile method takes two parameters: "bstrFilename" and "vFileType". "vFileType" is an OPTIONAL parameter. "bstrFileName" is a BSTR type and "vFileType" is a VARIANT type. To invoke this method from COBOL, you use the MODIFY verb:
MODIFY RICH-TEXT-BOX-1 LoadFile ("myfile.rtf", rtfRtf).
The ACUCOBOL-GT runtime automatically converts the parameters to the appropriate type and invokes the method. The LoadFile method does not have a return value. If the method had a return value that was not "void", it would be converted and moved to the item specified in the GIVING clause of the MODIFY statement. Note that the syntax is as if LoadFile is a property whose value is its parameter list. For example, the following is also valid:
MODIFY RICH-TEXT-BOX-1 PROPERTY 37 = ("myfile.rtf", rtfRtf).
Note that 37 is the "property" number of LoadFile. The equals sign is optional. Commas in the parameter list are optional. The parameters may be arithmetic expressions.