[Lazarus] GUI frontend to a console application
Hans-Peter Diettrich
DrDiettrich1 at aol.com
Tue Feb 24 16:38:28 CET 2009
Graeme Geldenhuys schrieb:
> I didn't mean writing a GUI in the console. I meant a true GUI app
> (LCL or fpGUI based), which uses a console application as the backend.
What then is your technical problem?
> For example, Linux has many GUI frontends for programs like makeiso,
> burncd, cdrecord, cvs, mpg123 etc...
These frontends most probably collect the options and then call the
backends with the appropriate command line.
Or they use the application libraries directly, without starting the
console programs. In this case the command line argument evaluation has
to be moved to the GUI frontend, which finally calls the same procedures
as the main procedure of the console application does. For easy
maintenance the console programs can be changed to use a shared library,
which then can be used by every frontend. The shared libraries then
should not do any console output, eventually output to stdout or stderr
must be caught by the frontend, or the handles must be redirected/piped
to the frontend. I never separated existing applications into shared
libraries, so I don't know about the best solution for console output.
When every output ends up in a few unique procedures, these procedures
can be replaced by callback functions, provided by the frontend and
installed during initialization of the shared library.
DoDi
More information about the Lazarus
mailing list