Forum > Beginners

Make main class wait for another class (console program)

<< < (2/4) > >>

Blaazen:
It's unusual. Normally, Lazarus project runs in endless loop and operates events until main form is closed or until you call Application.Terminate;.
But you mixed console application with visual forms.
Solution should be to convert it from "console application" to normal project.

BlueMoony:

--- Quote from: Blaazen on August 12, 2014, 05:57:37 pm ---It's unusual. Normally, Lazarus project runs in endless loop and operates events until main form is closed or until you call Application.Terminate;.
But you mixed console application with visual forms.
Solution should be to convert it from "console application" to normal project.

--- End quote ---

So I have to use a Form application to get this working?

The reason why I used this approach is the following:
The main unit determines what type of the program should be launched based on the type and amount of parameters given. When no parameters are present, the main unit launches the controlling unit which doesn't need any form or dialogs. This controlling unit is somehow used as a service but isn't a real service. The controlling unit than executes the same executable with other parameters so the other functionality of my program is used which includes showing forms/dialogs.

As I would rather like the main & controlling unit be as lightweight as possible, I thought this was the best way to go. I only need those Form libraries when actually showing one.

So your solution is the following: convert the console application to a normal (form-based) application and don't show the form of the main unit? Or do you have something else in mind?

Blaazen:

--- Quote ---As I would rather like the main & controlling unit be as lightweight as possible, I thought this was the best way to go. I only need those Form libraries when actually showing one.
--- End quote ---
In fact, it will not help you. Once you have one form in your program, whole LCL is included in compiled binary anyway, even if this form is never showed.
Converting from "console app." to normal application will not make your program bigger therefore. (Note that I never did a true measurement but I'm 99% sure).

BlueMoony:

--- Quote from: Blaazen on August 12, 2014, 07:06:32 pm ---
--- Quote ---As I would rather like the main & controlling unit be as lightweight as possible, I thought this was the best way to go. I only need those Form libraries when actually showing one.
--- End quote ---
In fact, it will not help you. Once you have one form in your program, whole LCL is included in compiled binary anyway, even if this form is never showed.
Converting from "console app." to normal application will not make your program bigger therefore. (Note that I never did a true measurement but I'm 99% sure).

--- End quote ---

That is totally true, but those components/libraries will only be loaded when they are needed so the resource impact will be different. I have a tight amount of resources available so all the points I can save on should be used.

So to clear things up: there is no way to make the console application in the first place (main unit) "wait"? There is no available function/procedure that allows me to do actually the same thing a Form/Dialogbox does: wait/loop?

Blaazen:
I don't know. Maybe it is possible but I don't know how.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version