[Lazarus] What to replace Application.Processmessages with?
Bo Berglund
bo.berglund at gmail.com
Sun Nov 1 11:37:14 CET 2020
On Sun, 1 Nov 2020 10:20:11 +0100 (CET), Michael Van Canneyt via
lazarus <lazarus at 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.
A quick test:
It seems like there is a problem with this...
I added this to the end of a random function:
{$IF DECLARED(TForm)}
Application.ProcessMessages;
{$ENDIF}
Even though the project does not use Forms (Search/Find in Files in
all project files does not find it) the code within the block is
marked enabled and a quick compile succeeds.
No file in the project declares Forms as a used unit.
Same thing happens if I check for Forms in the code above...
If I try to use the right-click/FindDeclarationOf on Processmessages
pops up an error:
class_SSRemoteServer.pas(530,5) Error: identifier not found:
Application
However, the app builds...
So maybe this is a problem with the Lazarus code editor not being able
to parse the {$IF DECLARED(TForm/Forms)} item?
To really check this I need to create a test app and run it in the
debugger, I guess..
In a command line program it should not generate code, right?
--
Bo Berglund
Developer in Sweden
More information about the lazarus
mailing list