THotLog

[ Home ]



Providing  visual feedback using a TMemo

THotLog's aim is to logg strings into a file. However, you may want to provide your user visual feedback too. This can be done by assigning a TMemo to the THotLog instance you're using, and requesting it to output the logged lines to that memo.

The memo is then accessed by a new thread (not the one which writes to the file). Adding lines into the memo is made within your application's main thread, througt the Synchronise( ); methode.

The three following routines are to used through a THotLog Instance, like for example: hLog.DisplayFeedBackInto(myMemo);


Procedure DisplayFeedBackInto(aMemo:TMemo);

Requests THotLog's instance to output the logged lines into a memo too. This job is made by a third thread. It's done after the line(s) have been logged.
aMemo has to be a TMemo component created before you pass it to the procedure. It can be visible or not, but must exist.


Function StopVisualFeedBack: Boolean;

This can be an ESSENTIAL function, if your memo isn't upon the main form: See MEMO USAGE WARNING.
StopVisualFeedback doesn't stop the feedBack thread, but tells the writer thread to stop accessing that thread, and tells the feeBack thread to stop accessing the memo.
The feedBack thread is still available, and can be launched again through a new call to DisplayFeedBackInto(aMemo:TMemo);
The function returns True if it succeeds, False otherwise. You should ALLWAYS check this result before choosing whether closing or hidding the form upon which your log feedback memo is, if it isn't on your application's main Form.


Procedure ScrollMemo(doScroll:Boolean);

If True, the memo will allways autoscroll down, to show it's last line.
If False, THotLog doesn't manage the scrolling.
(Remark : ScrollMemo(True) will have visible effects at run-time, but sometimes NOT when debbugging.)


Procedure SetMemoLimit(value: Cardinal);

Upadte provided by Oleg Danilov (rapidfd.com)
It allows to set a limit to the number of lines displayed by the memo used for the visual feedback. This can be usefull to handle the 32kb limit of the TMemo component under W98 and bellow, or simply to avoid huge outputs.