Page 1 of 1

Re: how to make the HTML source show in memo?

Posted: Sat Jun 15, 2019 7:03 pm
by salvadordf
Hi,

Use the TChromium.OnTextResultAvailable event in your form.

Call TChromium.RetrieveHTML and you will receive the HTML source in the "aText" parameter found in the TChromium.OnTextResultAvailable event.

Save the "aText" value in a class field called "FMyStringField" and later you can assign it to your memo like this :

Code: Select all

Memo1.Lines.Text :=  FMyStringField;
Most TChromium events are executed in a different thread. This can cause problems if you create, destroy or modify VCL controls inside those events.

To be safe, store the information you need from those events and send a message to the main form to handle the VCL controls in the main thread.

In this case, it's safer to assign "aText" to "FMyStringField" and send a custom message to the main form to assign FMyStringField to the memo lines.

Re: how to make the HTML source show in memo?

Posted: Mon Jun 17, 2019 7:12 am
by salvadordf
You have all the code you need in the MiniBrowser and PostInspectorBrowser demos.

The MiniBrowser demo has the code to get the HTML source and the PostInspectorBrowser demo shows how to store some text lines using a synchronization object to add them safely to a TMemo.