Using record structure classes
The generated PPtl record structure class includes five methods, as follows:
xAt: and xAt:put:
Get and set instance methods for the x value of each point in the array of points.
yAt: and yAt:put:
Get and set instance methods for the y value of each point in the array of points.
initializeAfterLoad
Class method that sets the fixed size of the record, not counting any variable components.
Instead of the techniques used in the defaultRows and setParameters scripts of the previous section, a script segment similar to the following can now be used to initialize an array of points:
| pointArray |
pointArray := PPtl new.
pointArray xAt: 1 put: 0;
yAt: 1 put: 0;
xAt: 2 put: 50;
yAt: 2 put: 50;
xAt: 3 put: 90;
yAt: 3 put: 25;
xAt: 4 put: 120;
yAt: 4 put: 125;
xAt: 5 put: 145;
yAt: 5 put: 110;
xAt: 6 put: 170;
yAt: 6 put: 120;
xAt: 7 put: 180;
yAt: 7 put: 105;
xAt: 8 put: 200;
yAt: 8 put: 130.
Now you are ready to access the drawGraph external C function and pass the pointArray you just created as a parameter.
Last modified date: 01/29/2015