I have a unit (X) where an enumerated type (TMyEnum) is defined.
I create a component (MyComponent) that uses that unit.
When I create a project that uses MyComponent I need to reference TMyEnum. I can solve this by adding X to the uses clause. This means I have to add X to the uses clause of every project that uses MyComponent.
I don't want to do that.
Is there a better way to inherit TMyEnum?
First, let's see, we have these five statements as facts:
- you have unit X where TMyEnum is declared
- you have a unit where TMyComponent is declared (let's say it's unit Y)
- you have a unit where you use TMyComponet (let's say it's unit Z)
- as TMyComponent needs TMyEnum, you had to include X in uses section of unit Y.
- as you use TMyComponent in unit Z, you had to include Y in uses section of unit Z.
You want to avoid adding X to uses section of unit Z (and any other unit where you use TMyComponent).
The advice you got in posts above says that, in interface section of unit Y, you can declare
type
TMyEnum = X.TMyEnum;
Then you will not need to include X in Z to be able to reference TMyEnum.
Okay?