[Lazarus] Form in DLL
Mark Morgan Lloyd
markMLl.lazarus at telemetry.co.uk
Thu May 3 17:06:48 CEST 2012
Michael Schnell wrote:
> On 05/03/2012 03:16 PM, Mark Morgan Lloyd wrote:
>> even if that meant that they were built up step-by-step under code
>> control rather than constructed from a description in resources.
> Yep. If you don't want to create a tool that uses the resources in the
> DLL and constructs the GUI from same, you can't use the Lazarus form
> designer and need to write code to manually add the controls you need
> for your plugin. IMHO it should not be too hard to do such a tool, as
> this is exactly what is done by the program startup code, anyway. You
> just need to take a look at the LCL part that does this
> (TApplication.CreateForm, when creating a non-Main form) and take out
> what you think is useful for that purpose. But (as said) you need to use
> the LCL of the main project, not that of the DLL. So the tool should be
> done in the main program, so that it attaches to the correct Application
> instance. You then need to pass the address of the resource to same when
> the DLL is "started" (e.g. by providing a function that returns that
> address). Beware, that the memory management should be unified before.
One thing does occur to me, and that is that if the IDE was used to
create a form stored in a DLL (or, presumably, a shared object library)
then it even if it's not animated it should be usable as a template for
copying to a blank form in the main program. And code to do that, once
written, should be fairly general.
--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk
[Opinions above are the author's, not those of his employers or colleagues]
More information about the Lazarus
mailing list