On Sun, 1 Nov 2020, Bo Berglund via lazarus wrote:
On Sun, 1 Nov 2020 10:20:11 +0100 (CET), Michael Van Canneyt via
lazarus <lazarus@lists.lazarus-ide.org> wrote:
QUESTION:
Is there a way in code to check if Forms is used?
So it can be used instead of {$IFDEF NOGUI}
normally
{$IF DECLARED(Forms)}
or
{$IF DECLARED(TForm)}
should do the trick for you.
I created this command line program:
program Test;
begin
Writeln('I will test the TForm check now:');
{$IF DECLARED(TForm)}
Writeln('TForm is declared...');
{$ELSE}
Writeln('Apparently TForm not declared');
{$ENDIF}
Writeln('I will test the Forms check now:');
{$IF DECLARED(Forms)}
Writeln('Forms is declared...');
{$ELSE}
Writeln('Apparently Forms not declared');
{$ENDIF}
end.
When I run it in a console:
$ ./Test
I will test the TForm check now:
Apparently TForm not declared
I will test the Forms check now:
Apparently Forms not declared
However in the Lazarus code editor the lines inside the {$ELSE}
clauses are shown as disabled even though these are the ones actually
present and running in the build...
Well, then the IDE codetools have an issue.
Michael.
--
_______________________________________________
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus