[Lazarus] Procedure variables

Guionardo Furlan guionardo at gmail.com
Mon Jul 29 22:19:48 CEST 2013


Use TProcedure as type of the properties.


2013/7/27 Timothy Groves <the.tail.kinker at 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 at lists.lazarus.**freepascal.org<Lazarus at lists.lazarus.freepascal.org>
> http://lists.lazarus.**freepascal.org/mailman/**listinfo/lazarus<http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus>
>



-- 
*Timeo hominem unius libri*

[]s
Guionardo Furlan
http://www.guionardofurlan.com.br
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20130729/b789fbc2/attachment-0003.html>


More information about the Lazarus mailing list