inputs in a class constructor

 

Hello everyone

I want to write a class witch in its constructor I want to have inputs, I can't simply write: 

private:

input int period;

that throws an error and also when trying to use a setter in the class constructor I can't use input either.

anyone got any idea? 

 
Mobin9179: I want to write a class witch which in its constructor I want to have inputs

Can't be done. Input class variables are for the terminal.

In OnInit, create your class via new and pass your variables to its constructor.

In OnDeinit, delete the class.

 
William Roeder #:

Can't be done. Input class variables are for the terminal.

In OnInit, create your class via new and pass your variables to its constructor.

In OnDeinit, delete the class.

Thanks for the answer. What I understood is that I have to declare how many input variables as I want in a global scope, and it can't be done inside a class constructor or any member functions so the input variable would be automatically declared when instantiating an object of that class?

 
Mobin9179 #:

Thanks for the answer. What I understood is that I have to declare how many input variables as I want in a global scope, and it can't be done inside a class constructor or any member functions so the input variable would be automatically declared when instantiating an object of that class?

Correct.

The problem is the execution flow.

inputs are displayed before the code is executed. At this point, there has not been any instantiation of any objects.

All you can do is split your inputs into files, and have conditional compilation. But, what hasn't been compiled, won't show up.

You cannot have dynamic inputs in the initial dialog.

What you can do is, create your own input dialog inside your code and configure that as you like.

I don't know of any other options.
 
Dominik Christian Egert #:
Correct.

The problem is the execution flow.

inputs are displayed before the code is executed. At this point, there has not been any instantiation of any objects.

All you can do is split your inputs into files, and have conditional compilation. But, what hasn't been compiled, won't show up.

You cannot have dynamic inputs in the initial dialog.

What you can do is, create your own input dialog inside your code and configure that as you like.

I don't know of any other options.
Thank you So much
Reason: