Question

I want to create a form with a twebbrowser and a tedit box, more if needed.

Then lets say, I want the browser to be on google.com and when I type in the search bar I want it to type in the tedit as well. Best would be at the same time but it is fine if i click away it will fill in the tedit box as well. i just want to understand how this work, Type on the site and have the edit boxed automatically typed as well.

anyone can help me?

Was it helpful?

Solution

There is no event in TWebBrowser (so far as I know) that fires as you edit the location (I don't think TWebBrowser has a search bar so I presume that's what you mean).

When I have tried to keep a host app in sync with a TWebBrowser I have used the OnBeforeNavigate2 event.

OTHER TIPS

I haven't tried this, but I bookmarked the web site a while ago.

Calling into Delphi from JavaScript

The article discusses how to call delphi-code from the TWebBrowser. You implements an external object extension by declaring an interface, and then registers it with the browser control. Doing that, you should be able to invoke delphi methods by using JavaScript in the web site.

You have to be in control of the source that is shown in the TWebBrowser, so the google example wouldn't work. ...unless you manipulate the html-source by injecting custom code before you show it in the TWebBrowser, of cource.

I hope this may put you the right track...

Reading your comment, you may consider to do it the other way around:

Type the search in the TEdit (and handle all the logging you need), and then navigate the TWebBrowser to this url: 'http://www.google.com/search?q=' + Edit1.Text

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