I have a working GUI program that asks the user for a file, does some calculations on it and puts the results in a text file. I want to set up a second Form in which, without further input from the user, I can illustrate the results by issuing some of the form's Canvas commands.
I've followed the tutorial
https://wiki.freepascal.org/Form_Tutorial and so have set up the second Form, with each Form having a button to switch to the other. My query is how and where to declare a procedure Drawit, or possibly Form2.Drawit or even Form1.Drawit, and how and where to call this procedure.
I've added Unit2 to the uses section of Unit1, and in defining the button click procedure in Unit1 I've followed the command Form2.ShowModal with a command Form2.Drawit.
In the interface of Unit2 I've declared procedure Drawit in the public part of the TForm2 type definition. Then in Unit2's implementation section
I define the procedure TForm2.Drawit to issue the command TForm2.Canvas.LineTo(500,500). But this produces the errors on compilation "Only class methods, class properties and class variables can be referred with class references" and "Only class methods, class properties and class variables can be accessed in class methods".
Apologies for this query from a GUI newbie (although an occasional Pascal programmer since 1976, and before that Algol60 and Algol68 since 1973).