Recent

Author Topic: array of TShapes  (Read 1342 times)

entrisity

  • New Member
  • *
  • Posts: 12
array of TShapes
« on: January 18, 2019, 11:30:46 am »
hey, doing a project where having a array of tshapes would be pretty neat, how do i do that? Thanks in advance :)

Josh

  • Hero Member
  • *****
  • Posts: 1271
Re: array of TShapes
« Reply #1 on: January 18, 2019, 01:22:09 pm »
Hi

Searching forum for array of tshapes give this
https://forum.lazarus.freepascal.org/index.php/topic,43502.msg304485.html#msg304485

Should cover what your after
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

Thaddy

  • Hero Member
  • *****
  • Posts: 14205
  • Probably until I exterminate Putin.
Re: array of TShapes
« Reply #2 on: January 18, 2019, 01:24:15 pm »
Yes. Good pointer. Combined with maybe this?
Code: Pascal  [Select][+][-]
  1. unit Unit1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls;
  9.  
  10. type
  11.   { TShapes }
  12.   TShapes = specialize TArray<TShape>;
  13.   { TForm1 }
  14.   TForm1 = class(TForm)
  15.   private
  16.      Shapes:TShapes;
  17.   public
  18.  
  19.   end;
  20.  
  21. var
  22.   Form1: TForm1;
  23.  
  24. implementation
  25. {$R *.lfm}
  26. end.
« Last Edit: January 18, 2019, 01:31:52 pm by Thaddy »
Specialize a type, not a var.

 

TinyPortal © 2005-2018