[Lazarus] Startup environment: to Gui, or not to GUI?

Mark Morgan Lloyd markMLl.lazarus at telemetry.co.uk
Tue Apr 11 13:38:07 CEST 2017


On 11/04/17 11:00, Tony Whyman via Lazarus wrote:
> This question could be reformulated as "How do I dynamically determine
> the correct GUI to use or whether to use the nogui interface."
> My understanding is that Lazarus programs usually do this at link time
> as a result of setting the LCL_PLATFORM environment variable.

Well, no, it couldn't :-)

What I'm doing is writing a  program using the Lazarus IDE and creating 
the project as "Application" so that I can easily add a full GUI later. 
I'm manually inserting code immediately after Application.Initialize to 
pick up command-line options (including --help and --version) which also 
gives me the ability to run the entire program from the command line if 
sufficient options/parameters have been supplied.

My experience in the past has been that this approach is reliable, and 
that it's also possible to raise a dialog for cases such as a program 
being run from the GUI but with a --version option.

I'm hoping to use this program as a testbed to run in three ways: 
non-interactively if sufficient options are supplied, with a GUI if no 
options are supplied, and /possibly/ using a TUI created by dialedit3b 
but this very much depends on whether the modifications required to get 
it working can be done in the limited time available.

What that will mean in practice is that irrespective of what widget set 
the program is compiled for it will also have the capability of running 
as a non-interactive (batch) utility. Call me old-school if you like but 
I find that useful.

http://free-pascal-general.1045716.n5.nabble.com/Free-Vision-etc-form-editor-td5727305.html

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]


More information about the Lazarus mailing list