Question

I want to preload HTML in TEmbeddedWB and use it in design mode. Here is my simple code:

UnicodeString html("<body><p>Hello world</p></body>");
EmbeddedWB->LoadFromString(html);
EmbeddedWB->DesignMode = true;

So after this the text "hello world" should be editable.

When I load from string it displays the HTML properly. But after enabling design mode, all text from control is cleared. It seems that the only way to load it is to use Navigate method and then to open designer - that seems to work. Is there a way to load if from memory and then enable design mode?

I tried to type in some text and enable/disable edit mode by click of a button that toggles it. That works just fine and does not clear the text between toggles. The problem is just with preloaded (initial) HTML.

Also, is there a mirror of bsalsa.com page? As the site went down a lot of valuable documentation, forum and other things were lost.

Update - some useful links related to this question:

Delphi-EmbeddedWB-XE3 on GitHub - Modifications for Delphi XE3

Archive.org Bsalsa.com page

TEmbeddedWB project on SourceForge (not the most recent version - last version released on bsalsa.com was 14.70.0)

Was it helpful?

Solution

I found the answer myself. It appears that there is additional component which works just for this particular purpose called TEditDesigner which makes all things related to editing trivial. Found the solution by looking into Demos folder (there are a lot of examples there for various things).

The solution:

Drop TEditDesigner on the form and connect it to the TEmbeddedWB using property EmbeddedWB or use EditDesigner1->EmbeddedWB = EmbeddedWB1; in code

Code that loads HTML and makes it editable then is the following:

EditDesigner1->ConnectDesigner();
UnicodeString html("<body><p>Hello world</p></body>");
EmbeddedWB1->LoadFromString(html);

// Optionally focus to it
EmbeddedWB1->SetFocus();

01 - EditDesigner_Demo (folder) shows a lot more things you can do with TEditDesigner.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top