[Lazarus] Using event driven components in console application

Mattias Gaertner nc-gaertnma at netcologne.de
Tue Nov 3 18:39:50 CET 2015

On Tue, 03 Nov 2015 18:20:53 +0100
Bo Berglund <bo.berglund at gmail.com> wrote:

> On Tue, 3 Nov 2015 14:55:54 +0100, Mattias Gaertner
> <nc-gaertnma at netcologne.de> wrote:
> >
> >lnet does not use Post/SendMessage, so it works even with the NoGUI
> >widgetset.
> >
> >You can easily implement your own loop and simply call
> >Application.ProcessMessages.
> >
> Thanks,
> you mean that Application.Processmessages is available in this console
> program?

It is available when you use the NoGUI widgetset.
If you don't use it, you have to call CheckSynchronize yourself.

> I did not know that. And it seems like TCustomApplication
> does not automatically include it either. I get a error "identifier
> not found: Application" when I try...
> But now I have a basic Lazarus IDE usage question:
> When testing the lnet functions I copied the files from the lNet
> download (the complete lib directory) to my pi home directory into an
> lnet dir and set the project path to include this dir.

AFAIK lnet has Lazarus packages. Use them instead of adding paths

> After successfully testing lnet I wanted to actually install it into
> Lazarus so I extracted the complete zipfile (according to install
> directions here:
> http://wiki.lazarus.freepascal.org/lNet#Installation) into my lazarus
> install dir at /home/pi/development/lazarus/components.
> Then I went into Lazarus menu Package/Open Package file as instructed
> on the webpage above and installed the lnet package.
> When it was all done and Lazarus restarted I removed the project path
> to the sources I used before and compiled my test project and it
> worked OK.

... and (hopefully) added the lnet lpk in the project inspector.

> Then, just to make sure, I right-clicked on the TLTcp type name and
> selected "Find declaration" and unit lNet opened in the IDE.
> But this unit is NOT where I expected it to be! Instead of in the
> Lazarus component directory it shows to be located in:
> /usr/local/fpc/source/utils/fppkg/lnet

You have two lnet. One installed by fppkg and one manually.
Open the right lnet .lpk once (Package / Open Package File).

> How did this happen? Seems like there is a copy of lnet in this
> location so which is Lazarus using? And how did it get there in the
> first place?

You used fppkg.

> I am running FPC 3.1.1 (svn trunk a couple of week back) and Lazarus
> 1.5 svn 50059M (don't know what M means)

The M means you have local modifications.


More information about the Lazarus mailing list