It returns 'ERROR' when something go wrong, but if the page do not responds, it freeze the app meanwhile. Are there any simple way to avoid this situations?Wrap in a thread.
I think it is not a good idea to use visual components like memo inside of threads.
See http://wiki.freepascal.org/Multithreaded_Application_Tutorial and https://forum.lazarus.freepascal.org/index.php/topic,38851.msg265181.html#msg265181 ... and alot of other posts ...
Can this be sintetized in one function?? Somehting like...Not in a function, no. But in a class yes.