[Lazarus] WriteLn back to the GUI

Michael Van Canneyt michael at freepascal.org
Wed Oct 23 17:55:28 CEST 2013

On Wed, 23 Oct 2013, ListMember wrote:

>> And I just found an example which already does this for TCustomEdit 
>> descendants: http://kd5col.info/swag/DELPHI/0017.PAS.html
>> I've not tested it in FPC, so maybe small adjustments might be necessary...
> Wow.
> This is far too (incredibly) elaborate.
> It's a bit like giving me plans to set up an army to invade a country when 
> all I want to do is to visit it as a tourist :)
> As I mentioned in my first post, I am prepared to alter the compiler sources;

And this you consider not elaborate? That's a nice one :)

> and I had this in mind:
> I would like to add these to a common unit --such as globals.pas
> type
>  TMyWriteLnCallback = procedure(AText: String);
> var
>  GMyWriteLnCallback: TMyCallback = nil;
> and then, wherever the 'compiler magic' for WriteLn is, use something like
> if Assigned(GMyWriteLnCallback) then GMyWriteLnCallback(TextStuff)
> else {do the usual console output}
> So, could someone tell me where I have to inject these lines.

As I wrote in my post: See the CRT unit.

It does exactly that. You need maybe 20 lines of code to do as you want.


More information about the Lazarus mailing list