EditSource event example

Can anybody give me an example of using the EditSource event of WebPageSource class?

Thanks.

The EditSource event is the only way to set/change the HTML in a WebPageSource control at runtime. You simply assign the Source variable to whatever HTML text you want. Note that this event only fires once, when the page is first instantiated. If you want to change the HTML after that, you’ll have to close the page, set it to nil, then start a new instance.

One question: What are you using WebPageSource for? Can you accomplish what you want with an HTMLViewer control? With that you can change the HTML at any time.

Also, if it’s just html, take a look at the WebSDK getting started tutorial. It shows you how to create an html control that can be updated at any time.

Thanks, solved. I needed to change the background of the webpage based on a value of hashtag and did not know how to shoot the event.

You can create background WebStyles and assign them to WebPages at any time - no need to use a WebPageSource control. Or, if the background you need isn’t possible with a WebStyle, you could also probably use ExecuteJavascript to modify the background at any time.