[Lazarus] Procedure variables
Timothy Groves
the.tail.kinker at gmail.com
Sat Jul 27 06:33:36 CEST 2013
Okay, I've spent an hour googling this one, and got no information that
helps. I want to declare four methods as being procedural variables, so
that I can set them and call them. Code follows. When I try to compile
this, I get:
glanguage.pas(37,20) Error: Incompatible types: got "<address of
function:AnsiString;Register>" expected "tLanguage.<procedure variable
type of procedure;Register>".
What am I doing wrong?
unit glanguage;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils;
type
tLanguage = class (tObject)
private
t_ClanNames : array of string;
t_language : integer;
procedure SetLanguage (a : integer);
public
FirstName : procedure;
LastName : procedure;
ClanName : procedure;
PlaceName : procedure;
property Language : integer read t_language write SetLanguage;
end;
implementation
uses
wrdsaxon;
const
LG_NONE = 0;
LG_SAXON = 1;
procedure tLanguage.SetLanguage (a : integer);
begin
case a of
LG_SAXON : begin
FirstName := @SaxonMale;
LastName := @SaxonFemale;
ClanName := @SaxonFamily;
PlaceName := @SaxonPlace;
end;
end;
end;
end.
More information about the Lazarus
mailing list