0

I have added some units to the uses part of my parent TForm.

Then I went to File > New... and created a form inhering my form which has the usages.

The child form seems not to have access to the units used in the parent form.

Is this the correct behavior or is it possible to inherit the uses?

Phiter
  • 14,570
  • 14
  • 50
  • 84
  • 1
    What would inheriting uses look like anyway? Uses are at the unit level and units are not inheritable. Types are inheritable and types don't directly have `uses`. So what you are suggesting doesn't really make sense when you look harder. – David Heffernan Apr 18 '18 at 17:56

1 Answers1

4

This behaviour is correct. The units listed in a uses clause are made available to that unit only.

If your other unit, containing he derived class, requires symbols from other units, it must list those units in its own uses clause.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
  • Thank you! The thing is that my parent form uses a datamodule that contains a database connection that I'm using in a `dataSource` component that I put in the parent. I expected this datamodule to be available to the child forms without having to add them to the use clause, and without needing to copy the component from there to the parent form. – Phiter Apr 18 '18 at 18:01
  • Well, you should not have to copy a component. But that is unrelated to `uses`. Sounds like things aren't quite as you described. – David Heffernan Apr 18 '18 at 18:03
  • I have to add the datamodule unit to my `uses` to access its database component, right? – Phiter Apr 18 '18 at 18:09
  • These terms are too vague. I thought you referred to a component on the form. Anyway, I think the question is done. – David Heffernan Apr 18 '18 at 18:16