Using next code and call te procedure OpenHistory() I get the access violation:
============================================
unit Global;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
fphttpclient, RegExpr;
type
TForm3 = class(TForm)
private
{ private declarations }
public
{ public declarations }
Procedure OpenHistory();
end;
type
SStation = record
SUrl:String;
SImg:String;
end;
var
G: TForm3;
History: Array of SStation;
implementation
{$R *.lfm}
Procedure TForm3.OpenHistory();
begin
// History[0] := SStation. how to make room... //
History[0].SUrl:='Url';
History[0].SImg:='Img';
end;
---------------------------------------------
When I call this procedure I get the access violation.
I call it as G.OpenHistory() and Global is in the uses.... its about just this procedure.
Should I have first done some new or create for the new record of type History ?
The Compiler likes it but on runtime it fails.
Any help is appreciated. ( I tried a same thing with TstringList, which sould be possible, but that blows my mind totally , even with the lost of examples.)