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

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Thu May 4 13:31:05 CEST 2017


On 2017-05-04 11:18, Mark Morgan Lloyd via Lazarus wrote:
> In case it helps anybody avoid wasted time: looking carefully at what 
> I've been doing, it turns out that it's not possible to make an 
> LCL-based program running on unix (i.e. with X11 etc.)

And it wouldn’t be right if I didn’t offer up an alternative. fpGUI
based applications can indeed do what you want. I do this all the time
for command line handling. If a GUI program is run from a terminal (no
X11 server), it will still output to the console telling the user what
program it is, version info, command line parameters and importantly,
that it requires a GUI to function. In a GUI environment (eg: MS
Windows) it will display a dialog with all the same information, if the
-h command line parameter was passed in.

Here is such output of one of my programs (run from the login terminal -
no X11):

=======================================
$ ./osmail -h
Opensoft Mail & News v1.00 (build 18)
Compiled on 2017/05/01 11:09:41

The following parameters are available:

   h, help        Shows this help
   lc             Logs debug information to the console
   lv             Logs debug information to a visual screen
   ls             Logs debug information to debug server
   l              Logs debug information to a file
   style          Applies a custom style to the application. Available
                  options are: "auto", "Win2000", "Motif", "Carbon",
"Plastic Dark", "Plastic Dark Gray", "Plastic Medium Gray", "Plastic
Light Gray"

NOTE: This program requires a graphical windowing environment to function.
$
=======================================

So as you can see, what you want to do is possible. Maybe LCL just needs
more work around its initialization code - being less eager to
initialize its GUI. ;-)


Michael's suggestion of two binaries is also a good idea.

Regards,
  Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp


More information about the Lazarus mailing list