[Lazarus] When do I need a component rather than a plain object?

Graeme Geldenhuys graemeg.lists at gmail.com
Tue Nov 16 15:04:10 CET 2010

Op 2010-11-16 15:13, Mattias Gaertner het geskryf:
>> In fpGUI, I use the same method as 'bin2obj', making such resources simply
>> arrays of bytes. 
> And then?
> Image.Data := ...

In a nutshell, yes. fpGUI's image handling is not identical to LCL's
though. Below is example code of loading and registering a new image with
an application.

  fpgImages.AddMaskedBMP('tadmin.edit',  @tadmin_edit16,
      sizeof(tadmin_edit16), 0,0 );

  fpgImages.AddBMP('tadmin.copy',  @tadmin_copy16,

tadmin_edit16 is the image array identifier. The string name (first
parameter) is what I call an "image alias" and can be anything the
developer wants. Once registered, you can get a reference to that image
from anywhere inside the application by simply calling.

  img := fpgImages.GetImage('tadmin.edit');

> sometimes nicer. I just think that this not always the case. And in my
> experience for medium/big projects I prefer to keep them separate. I
> guess that is just a matter of workflow.

Yes, it's a what you are used to or personal preference I guess.

  - Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal

More information about the Lazarus mailing list