As a side note, in order to figure out if your program is running under X11 in Linux you can simply check for the DISPLAY environment variable:
program test; uses SysUtils; begin if GetEnvironmentVariable('DISPLAY') <> '' then Writeln('Hello X11') else Writeln('Hello Console'); end. Obviously the program will detect X11 even if it is running under a terminal emulator like xterm, konsole, gnome-terminal, etc. This way you can detect if the user tries to run the program from a pure console (like a virtual terminal from Ctrl+Alt+F1 to F6 in most Linux machines or from a remote connection via SSH) or from under X11 and use the appropriate user interface at launch time. On Sun, Apr 14, 2013 at 3:54 PM, leledumbo <leledumbo_c...@yahoo.co.id>wrote: > If your design is modular enough, you can use frontend-backend > architecture. > Only the frontend should differ. This could be achieved by having 2 .lpi > referencing the same backend unit, with each own frontend (user interface). > > Another way would be to use build mode, differing in -Fu paths. One will > refer to the console unit, while the other to the gui. This way requires > you > to have both units having the same interface. To ease maintenance, you > could > instead make one unit, but the implementation part is just an {$include} > directive. This time, -Fi (instead of -Fu) will decide the path where the > include file should be searched. So the layout is like: > > Solution 1 (-Fu): > -backend.pas > -frontend/ > --console/ > ---frontend.pas > --gui/ > ---frontend.pas > > Solution 2 (-Fi): > -backend.pas > -frontend.pas > -include/ > --console/ > ---frontend.inc > --gui/ > ---frontend.inc > > > > > -- > View this message in context: > http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-Linux-GUI-Application-define-CONSOLE-tp4030537p4030599.html > Sent from the Free Pascal - Lazarus mailing list archive at Nabble.com. > > -- > _______________________________________________ > Lazarus mailing list > Lazarus@lists.lazarus.freepascal.org > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus >
-- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus