yeah i copy pasted a couple of times between various things I did at the moment and ended up missing a var declaration sorry about that, but my second post was about changing global variable declaration from S:string; to S:Variant;; here is the complete unit with all the changes required to make work.
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
procedure SetVar(var aVariable: Variant; const avalue: Variant) ;
end;
var
Form1: TForm1;
b: Boolean;
s: Variant;
i: Integer;
implementation
{$R *.lfm}
procedure TForm1.SetVar(var aVariable: Variant; const avalue: Variant) ;
begin
if (avariable <> avalue) then
begin
avariable := avalue;
showmessage('inside: ' + string(avariable));
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
s := 'boat';
ShowMessage('before: ' + s);
SetVar(s, 'car');
ShowMessage('after: ' + s);
end;