Questions tagged [datamodule]

A Data Module (TDataModule) is a class in Delphi which represents a non-visual form, only allowing non-visual components. Data Modules are often used to encapsulate common business rule, components commonly used across an application, and are used as a base for various infrastructures, such as a Service (TService) or a Web Module (TWebModule).

A Data Module (TDataModule) is a class in Delphi which represents a non-visual form, only allowing non-visual components. Data Modules are often used to encapsulate common business rule, components commonly used across an application, and are used as a base for various infrastructures, such as a Service (TService) or a Web Module (TWebModule).

64 questions
18
votes
2 answers

Delphi XE2 Data Module expects only database components?

In prior versions of Delphi, I have used the data module (TDataModule) as a place to keep non-visual components to avoid cluttering up the main form. In Delphi XE2, when I create a new data module, it only allows me to place database related…
Jerry Dodge
  • 26,858
  • 31
  • 155
  • 327
12
votes
4 answers

Delphi style: How to structure data modules for unit-testable code?

I am looking for some advice about structuring Delphi programs for maintainability. I've come to Delphi programming after a couple of decades of mostly C/C++ though I first learned to program with Turbo Pascal, so I'm not uncomfortable with the…
wades
  • 927
  • 9
  • 24
9
votes
3 answers

Drawing on a DataModule in Delphi

I wonder how difficult it would be to be able to have a custom background or be able to draw on the datamodule canvas somehow so that the relationships of all the datasets can be nicely represented with arrows and stuff. Way back in Delphi 7 or so…
Alister
  • 6,527
  • 4
  • 46
  • 70
8
votes
4 answers

Delphi DataModule Usage - Single or Multiple?

I am writing an application, there are various forms and their corresponding datamodules. I wrote in a way that they are using each other by mentioning in uses class(one in implementation and another in interface to avoid cross reference) Is this…
user517535
  • 81
  • 1
  • 3
7
votes
2 answers

Example of Delphi refactoring involving data aware controls and datamodules with direct access to db tables

I am trying to define the best way to refactor the project I am working on. Due to lack of good design almost all project is made up of: 1) forms containing business logic 2) huge datamodules (1 per form + some extra ones) 3) some units that contain…
UnDiUdin
  • 14,924
  • 39
  • 151
  • 249
7
votes
2 answers

Delphi - How do I send a windows message to TDataModule?

I need to send a windows message to a TDataModule in my Delphi 2010 app. I would like to use PostMessage(???.Handle, UM_LOG_ON_OFF, 0,0); Question: The TDataModule does not have a Handle. How can I send a windows message to it?
Charles Faiga
  • 11,665
  • 25
  • 102
  • 139
7
votes
1 answer

TDataModule descendant 'created' without .Create but no issues?

I suddenly noticed a TDataModuleTestExchange(nil) 'constructor call' in our codebase: procedure TDialoogConfigExchange.ButtonTestClick(Sender: TObject); var lDataModuleTestExchange: TDataModuleTestExchange; lResult :…
Jan Doggen
  • 8,799
  • 13
  • 70
  • 144
7
votes
4 answers

Why would a module be unsavable until another module is loaded?

Most of the units I work on rely on a Data Module. One of the most annoying things I come accross is an error message telling me Module X references another module and cannot be saved until Module Y is loaded. Now, I'm sure there is a very good…
James
  • 9,774
  • 5
  • 34
  • 58
6
votes
5 answers

DataModule created before main form

Some database application developers prefer to create a data module before main form by editing the project source file like this begin Application.Initialize; Application.MainFormOnTaskbar := True; Application.CreateForm(TDM, DM); …
kludg
  • 27,213
  • 5
  • 67
  • 118
5
votes
3 answers

Unit-testing Delphi data modules

If all the business logic is present in a datamodule (TSQLDataSets and TDataSetProviders) how would you refactor the code to make the application more appropiate for unit testing?
Tihy
4
votes
2 answers

Delphi unit automatically gets added to uses in Seattle

In my Firemonkey multi device project the IDE keeps adding the unit "FireDAC.VCLUI.Wait" to my uses in a data module of my project. This unit keeps me from building the project, because it can't resolve the name in Android or iOS. The strange thing…
Remi
  • 1,289
  • 1
  • 18
  • 52
4
votes
6 answers

How can I search a large XML data set?

I have a DataModule with XML and I need do a search... Unfortunately there are more than 300,000 records and I can't make a loop to check one-by-one. Is it possible to make a query without using a database? Is there another solution?
Leo
  • 1,753
  • 3
  • 20
  • 23
4
votes
1 answer

What does TDataModule.ClassGroup pseudo-property in Delphi XE2 really do?

I tried to copy and paste a component from one data module into another in Delphi XE2. The component was a Fast Report data source link component. The data module was brand new, just created that second, in XE2. Someone else had the same problem…
Warren P
  • 65,725
  • 40
  • 181
  • 316
3
votes
3 answers

Access an event on a DataModule from another Form

In Delphi 2009 I have a Form with a procedure MyProcedure that writes to a label on the Form. The form uses a DataModule with a ClientDataSet. When the AfterScroll event of the ClientDataSet is fired MyProcedure should be executed. To avoid circular…
RR-NL
  • 166
  • 3
  • 7
3
votes
2 answers

Why main form can't access to DataModule's images and actions when project is open in Delphi XE?

My Delphi XE application was fine till a couple of days and I can't figure out what is wrong. My project layout: Visual controls are on the main form Actions and image lists for those controls are on a data module When I open my project, the main…
jonjbar
  • 3,896
  • 1
  • 25
  • 46
1
2 3 4 5