Re: [Lazarus] Procedure variables

2013-07-29 Thread Guionardo Furlan
Use TProcedure as type of the properties.


2013/7/27 Timothy Groves the.tail.kin...@gmail.com

 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.


 --
 __**_
 Lazarus mailing list
 Lazarus@lists.lazarus.**freepascal.orgLazarus@lists.lazarus.freepascal.org
 http://lists.lazarus.**freepascal.org/mailman/**listinfo/lazarushttp://lists.lazarus.freepascal.org/mailman/listinfo/lazarus




-- 
*Timeo hominem unius libri*

[]s
Guionardo Furlan
http://www.guionardofurlan.com.br
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Procedure variables

2013-07-26 Thread Timothy Groves
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.


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Procedure Variables

2013-07-26 Thread Timothy Groves
No, wait, I'm stupid.  The procedures I'm assigning to methods are in 
fact *functions.*  Compiles clean now.


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus