[Lazarus] Easiest way to "case" strings

Graeme Geldenhuys graemeg.lists at gmail.com
Thu Mar 26 12:43:22 CET 2009


On Thu, Mar 26, 2009 at 10:29 AM, Hans-Peter Diettrich
<DrDiettrich1 at aol.com> wrote:
> I also found at least one use for records with methods, in the emulation
> of C structs with bitfields or unions. For that matter 'object' and
> properties came in handy.

Yup, I still use 'object' often. As in the case of fpGUI Toolkit's
TfpgRect type.

  TfpgRect = object  // not class for static allocations
    Top: TfpgCoord;
    Left: TfpgCoord;
    Width: TfpgCoord;
    Height: TfpgCoord;
    procedure SetRect(aleft, atop, awidth, aheight: TfpgCoord);
    function  Bottom: TfpgCoord;
    function  Right: TfpgCoord;
    procedure SetBottom(Value: TfpgCoord);
    procedure SetRight(Value: TfpgCoord);
  end;

And as the comment says, I use 'object' instead of class, so I don't
explicitly have to create an instance, I can just declare a variable
and use it.


Regards,
  - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/



More information about the Lazarus mailing list