Begin by creating a new visual part. Add a Form part and a Push Button part. Open the settings of the Form part and set the border width to 1. Change the label of the Push Button part to Draw.
To hold the list of points that are graphed, add an ordered collection. To create an attribute-to-script connection that fills in its contents, connect its self attribute to the following script:
defaultRows "Answer some dummy data" | collection | collection := self subpartNamed: 'Ordered Collection1'.
collection add: 0@0; add: 50@50; add: 90@25; add: 120@125; add: 145@110; add: 170@120; add: 180@105; add: 200@130. ^collection.
Add a C External Function part to any open space of the free-form surface. Open the settings for the external function part and change the following settings:
Use the Prototypes page to parse the include file, cgraph.h, and build the function's parameter list. From the list of procedure names, select drawGraph and then select OK to save the settings.
AbtCLangParser messageLevel: 0. AbtCOBOLLangParser messageLevel: 0.
Also, VisualAge normally keeps a DLL open until you shut down VisualAge. This can be an inconvenience during development when a DLL needs to be replaced after rebuilding it. To force VisualAge to close the DLL send the closeLibrary message to your External Function part.
Because this function takes an array as a parameter, a script is required to set up the data properly.