Implementing Find/Find next in wxHtmlWindow

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
gbuergisser
Knows some wx things
Knows some wx things
Posts: 31
Joined: Mon Nov 07, 2011 12:41 pm

Implementing Find/Find next in wxHtmlWindow

Post by gbuergisser »

Hi all,

In my application I use a wxHtmlWindow to display report data. Now I'd like to add 'Find/Find next' functionality (using wxFindReplaceDialog). But how shall I visually indicate the occurances of the search string in the html window? The only idea I have is to rebuild the file and include color tags around the occurances. But now, how to scroll the window to the next occurance automatically?

Thanks for any input, I don't believe I'm the first one to try this :wink:

Regards,
Gregor
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Implementing Find/Find next in wxHtmlWindow

Post by doublemax »

If you're using wxWIdgets 3.0. the easiest way is probably to switch to wxWebView instead of wxHtmlWindow.

With wxHtmlWindow, i could only think of this way: When generating the html code, you include unique anchors into the code, e.g one for each line. Then you could use the protected method ScrollToAnchor() to scroll to that anchor.
Use the source, Luke!
gbuergisser
Knows some wx things
Knows some wx things
Posts: 31
Joined: Mon Nov 07, 2011 12:41 pm

Re: Implementing Find/Find next in wxHtmlWindow

Post by gbuergisser »

Thank you for your reply. Not yet using version 3. But probably that's the way to go.
Post Reply