[Lazarus] LCLWidgetType CustomDrawn

Michael Schnell mschnell at lumino.de
Fri Dec 2 10:08:48 CET 2011


On 12/01/2011 05:29 PM, Felipe Monteiro de Carvalho wrote:
> I think that the 5 or so APIs from the LCL that deal with lower level 
> events (PostMessage, QueueAssyncCall, SendMessage, etc) could be 
> implement with a timer and an event queue. The rest of the LCL does 
> not require direct interaction with an event queue, it can also work 
> through direct events from the OS. 
I don't think that this needs to be be implemented "on top" of TTimer. 
But in fact (if the "GUI-backend" does not provide this function) TTimer 
does need a queue that uses OS-based non-busy waiting at the output of 
the queue and an OS-based way to generate the time-based (thus 
asynchronous) events as an input into the queue. The asynchronous 
Mainthread Signaling features need the same stuff, only that the input 
into the queue is generated by a thread. (In fact TTimer can be 
implemented using a thread that performs an OS-API "sleep" and when 
woken generates an input into the queue and goes back to sleep again.)

This is rather easy to do. The tricky thing is merging the events that 
are generated by the GUI background with those that are generated by 
threads (or other directly OS-API based function).
>>   - "ifi" (the backend is attached via a bidirectional byte stream such as a
>> pipe, a socket or an asynchronous port.
> LCL-Android worked like that, attached via pipes to the Java side. It
> actually worked OK.
Great !

So I vote for doing an class-inheritance based or otherwise flexible 
implementation that allows for switching the actual transport when 
adding new backend variants (such as "none" "pipe", "IP-socket" or 
"asynchronous".

>>   - http (the backend is done in java script and runs in a browser, the
>> connection is done using the http protocol<see ExtPascal / ExtJS>)
> I think that it would work badly due to latency and it would load a
> lot the server.
Of course you are right that this is a performance hog. "FastCGI" and 
(on Microsoft IIS) ISAPI will need to be used. "Comet" could reduce the 
polling overhead (for server->Browser events) but I heard that it is not 
very reliable. OTHO AFAIK there are several working (non Pascal) 
projects using EXTJS. So I suppose this should be doable. Obviously this 
is a lot of work and the look and feel will be very different vs a 
standard LCL GUI. But in the past, here, there have been a lot requests 
for CGI programs with an LCL based GUI in the Browser.

-Michael




More information about the Lazarus mailing list