2

I have a bunch of TTable and TSQL Components displayed on a datamodule. If I had these components on a form, I could put related ttable icons on a panel, or put a label next to them, so I could group them, making them easier to find/orgqanize. TDataModule does NOT allow visible components on it. Is there any way that I can place TTables/TSQL components near each other and them put some kind of descriptive entry (such as a label) near them so I can find them easier?

Thanks

menjaraz
  • 7,551
  • 4
  • 41
  • 81
user1009073
  • 3,160
  • 7
  • 40
  • 82
  • You do have the *Show component captions* designer option turned on, don't you? – Andriy M Mar 09 '12 at 02:31
  • 1
    @AndriyM That's an option for the _form designer_, isn't it? Component captions are always shown on data modules. – NGLN Mar 09 '12 at 06:04
  • 1
    @NGLN: You are right, I seem to have completely forgotten that. The projects I've been working on lately never use data modules. Thanks for the correction. – Andriy M Mar 09 '12 at 07:39

4 Answers4

4

You could split it up into separate DataModules, putting related datasets on each one. Perhaps one would contain the connection component that the others would reference.

Alan Clark
  • 2,017
  • 21
  • 28
  • +1 I usually have a "database data module" and many other data modules which each hold groups of several related tables and queries. Each "table/query" data module uses the "database data module" to get at the database connection. Forms use all table/query data modules they need and don't bother with the "database data module" unless they want direct access to the connection (should be an exceptional circumstance). – Marjan Venema Mar 09 '12 at 07:40
2

You can certainly group them together, simply place them close together visually and leave some space between multiple groups. DataModule is a non-visual container, so make it as large as you need, you will only see at design-time.

There is no way to label the groups, though.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
1

Maybe you can inherit and register a useless TComponent decedent, give it a eye-catching icon and then consider it as a group label. Put that component in the top / button of your visually separated (by empty space) group and use its name to describe the group

You can find more information of creating this component and setting image in this post : delphi non visual component image

Community
  • 1
  • 1
Justmade
  • 1,496
  • 11
  • 16
0

Also you can create all components dynamically (in data module), we have much opportunities to customize code - such as {$REGION 'custom region name'}//any code{$ENDREGION}, comments and code formatting. SQL texts can be inserted in application as resources (or xml, or database), for simple assignment to dynamically created components.

When we change some component properties through IDE, it's truly hard to find differences in big amount of non visual components. I have more that 100 non visual components in one data module... They grouped visually, but it's not convenient. If all components will be created dynamically i will get more lines of code, but this can be avoided via universal construction procedure. But i easy can find differences in all similar components.

George
  • 75
  • 1
  • 9