On Tue, 1 Sep 2020 14:21:44 +0200 (CEST), Michael Van Canneyt via
fpc-pascal
<fpc-pascal@lists.freepascal.org> wrote:

>You must still set the default value in the constructor.
>
>>
>> Note that the thread itself has no idea what is the baudrate in use so
>> it cannot calculate the proper value at the start of Execute...
>> And there is no Create method either that I can use.
>
>The constructor can always be overridden.
>

I did this:
  TComPortReadThread=class(TThread)
  private
    FBuffer: TBytes;
    FReadPacketSize: integer;
    FReadTimeout: integer;
  public
    MustDie: boolean;
    Owner: TFpSerialPort;
    constructor Create; override; //<= THIS ADDED, GIVES ERROR
    property ReadPacketSize: integer read FReadPacketSize write
FReadPacketSize; //How many bytes to read in each operation
    property ReadTimeout: integer read FReadTimeout write
FReadTimeout;    //Max time to wait for data in thread
  protected
    procedure CallEvent;
    procedure Execute; override;
  published
    property Terminated;
  end;


and the code will not compile:

fpserialport.pas(41,17) Error: There is no method in an ancestor class
to be overridden: "constructor Create;"

So, does TThread not have a constructor????
I thought all objects had.


-- 
Bo Berglund
Developer in Sweden

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to