Search String from an HTMLViewer

In a Project, I create html files (Texts and images).

I use an HTMLViewer to render the html (from a TextArea).
I add a Search(Text As String) feature and it works fine: I find html code as well as text.

Now, I need to add a Search(Text As String) feature in the HTMLViewer.

Using Firefox (a browser) Search feature is not a solution. Too many Applications swaps (and save the html to disk then load it is boring, error prone), too few screens…

But I do not know where to start.

Ideas are welcome.

I think you want to use javascript to call Window.Find()Window.Find

Something like this: htmlviewer1.ExecuteJavascriptSync("window.find("""+textToSearch+""",false,false,true).toString();")
Cast the return value to a string (in the javascript) since ExecuteJavascriptSync only returns strings and ints – you’ll get true or false back indicating if something was found. Use the booleans in the call per the documentation to search forward/backward. This will also highlight the found item. Note that you may need to use webkit (per the non-standard warning).

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.