Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2017-02

TDataModule for non-database non-visual components

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Kostas Michalopoulos

Hi all,

A simple question, is it ok to use a TDataModule for non-visual components that can be shared among forms (and generally contain app-wide stuff)? There doesn't seem to be a plain TModule or something like that. I ask because the docs do not make the distinction clear (the name doesn't help) and the wiki has it in the database section.

I suspect this is the case and in Delphi/Embarcadero docs it explicitly mentions that you can use it for non-database components, i just want to make it sure it wont blow up in the future (and that there isn't another way to create non-visual components from the IDE) because i just realized that TDataModule can be used like that (currently i'm creating non-form-specific components either in the main form or manually via code in a dedicated unit).

My use case is a few custom non-visual components which can be shared among forms (and to decouple the logic from the form when it has nothing to do with it).

Kostas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20170206/8c4ab1e9/attachment.html>

Reply by email

Mattias Gaertner
to Kostas Michalopoulos

On Mon, 6 Feb 2017 21:17:48 +0200

Kostas Michalopoulos wrote
Hi all, A simple question, is it ok to use a TDataModule for non-visual components that can be shared among forms (and generally contain app-wide stuff)?

Yes. That's their purpose.

[...]

Mattias

Reply by email

Kostas Michalopoulos
to Mattias Gaertner

Great.

But maybe that should be made clear in the docs like Embarcadero's docs mention? Because both the wiki and the name imply a database orientation.

On Tue, Feb 7, 2017 at 12:15 AM, Mattias Gaertner via Lazarus <

Show quoted text 23 lines
wrote: On Mon, 6 Feb 2017 21:17:48 +0200 Kostas Michalopoulos via Lazarus wrote: > Hi all, > > A simple question, is it ok to use a TDataModule for non-visual components > that can be shared among forms (and generally contain app-wide stuff)? Yes. That's their purpose. >[...] Mattias -- _______________________________________________ Lazarus mailing list http://lists.lazarus-ide.org/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20170207/a759a797/attachment.html>

Reply by email