[Lazarus] When do I need a component rather than a plain object?
Mattias Gaertner
nc-gaertnma at netcologne.de
Tue Nov 16 14:13:03 CET 2010
On Tue, 16 Nov 2010 14:46:08 +0200
Graeme Geldenhuys <graemeg.lists at gmail.com> wrote:
>[...]
> > there is no simple source equivalent. For example images and icons.
>
> In fpGUI, I use the same method as 'bin2obj', making such resources simply
> arrays of bytes.
And then?
Image.Data := ...
> For readability (before Lazarus supported user defined
> code folding) I stored those in include files, but this is not required any
> more - see below.
>
>
> >> So why emulate the C-style (multiple files requirement) in Pascal?
> >
> > Readability.
> > The form data easily grows to thousands of lines (e.g. icons).
> > Putting that into the source code breaks the readability rule to keep
>
> Not necessarily, if you use code folding (which is on by default in Lazarus
> IDE). fpGUI's UI Designer creates code as follows:
>
>
> procedure TMainForm.AfterCreate;
> begin
> {%region 'Auto-generated GUI code' -fold} [...]
> end;
>
>
> So with Lazarus IDE's code folding, by default the above is all that the
> developer will see, unless they expand that code-folding region themselves.
... or search a word. Then the region is unfolded and not automatically
folded.
Graeme, you are right, that putting the form data into the unit is
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.
Mattias
More information about the Lazarus
mailing list