[Lazarus] creating a Lazarus package "NoGUIApplication"

Joost van der Sluis joost at cnoc.nl
Mon Mar 15 20:54:56 CET 2010


On Mon, 2010-03-15 at 13:18 +0100, Michael Schnell wrote:
> On 03/15/2010 12:31 PM, Joost van der Sluis wrote:
> >
> > It works perfectly. You can use it to compile any fcl-web application
> > against. So that there are no dependencies on external gui-libraries
> > (like gtk, qt etc)
> >   
> 
> OK. "Works" here obviously means that it helps the application to be
> compiled, but it does not provide much functionality to the Application.
> Especially (other than the other 8 Widget Types) it does not implement
> an event queue (or attach to one provided by the OS). That is why a
> TTimer will not be usable.

Works means that I can use lazarus-resources and other lcl-stuff without
dragging in any GUI-bindings.

> The NoGUI Widget Type does allow for "fcl-web" applications, that are
> normal CGI program. I.e. started by the web server and is provided with
> information by same via environment variables, a web page is only
> transferred to the web server when the cgi program closes.

Fcl-web is a framework on which you can make 'anything' you want. You
can use FCGI and your program will be persistent. You can use the
webmodules. If you do, you can let the framework create a new webmodule
for every call. (REST) But you can also make them persistent. You can
even bind them to one session. So you have one Webmodule persistent in
memory for every session.

It doesn't have a queue, though. Because the web-server handles that.
(Each http-request is an event) But I've never tested that with
session-persistent webmodules. Maybe that needs some more handling. 

> The NoGUI Widget Type does not allow for "persistent" CGI applications.
> I.e. the cgi program keeps running and is provided by the web server
> with informations via a pipe or TCP/IP connection. It send a web page to
> the web server via a pipe or the TCP/IP connection appropriately. (Not
> all web servers allow for this method; Apache does.

> To do a decent "persistent" CGI applications you need to use timers,
> TCP/IP, threads etc: all this stuff creates asynchronous events that
> need to fire application "events" in the main thread, which keeps on
> waiting for such events independently of the CGI activity, On top of
> this, on the Web Client site there are methods (provided by Java script
> applets) that allow for monitoring the activity of such a program using
> a kind of polling on a kept-open HTTP connection. This is based on AJAX
> and is called Comet.

Using an HTTP connection which is kept open is not supported. You could
try to add it, though. But maybe that you have to add more threading and
polling code, indeed.

> While doing a  "persistent CGI program" is one application for an
> event-queue enabled NoGUI Application (that avoids any dependencies on
> external gui-libraries) my target is embedded devices which don't
> provide any hardware that could enable a GUI.

What's wrong with using remote-X?

Joost.





More information about the Lazarus mailing list