Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.

how to make the HTML source show in memo?

Post Reply
User avatar
salvadordf
Posts: 4042
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

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

Post 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.
User avatar
salvadordf
Posts: 4042
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

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

Post 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.
Post Reply