Home Cannot set enum type in published property of a component
Reply: 0

Cannot set enum type in published property of a component

user1575 Published in May 25, 2018, 9:01 am

I am writing a component and this is the main class with the most important pieces of code:


 TEquationSolver = class(TComponent)
     FSolver: TSolverType;
     property RootFindAlgorithm: TSolverType read FSolver write FSolver;

In the uses clauses I've added Equation because inside Equation.pas I have declared this kind of enum:

 TSolverType = (TNewtonRaphson = 0, TSecant, TBisection, TBrent);

In this way I am able to have in the IDE an option in the Object Inspector with a dropdown menu.

I have installed the component and while I was testing I've found this problem:

procedure TForm1.Button1Click(Sender: TObject);
   EquationSolver1.RootFindAlgorithm := TSolverType.Secant;

The error is the following:

[dcc32 Error] Unit1.pas(29): E2003 Undeclared identifier: 'TSolverType'

My question is very simple: why?

In the Unit where I am running the test (simple VCL form) there is the component with its uses included and so I am able to "see" TEquationSolver. As you can see at the top inside the unit of TEquationSolver I have included Equation and the latter has TSolverType.

The situation is the following:

Do I have to add something under the uses somewhere? I don't want to add stuff to the uses of Unit1.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.371597 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO