I would like to implement a log viewer that can display formatted HTML text then append small portions of HTML to the existing (usually very long) document. wxHtmlWindow seems to be good for the purpose.
As far as I know this is possible with AppendToPage but I find it really annoying and problematic that it reloads (re-parses, redraws) the entire page every time. At very long HTML documents this can take several seconds. I would like to achieve that wxHtmlWindow loads, parses and draws only the appended part, same as document.write() JavaScript would do to an HTML document in a browser.
Any help is appreciated.
Append HTML to wxHtmlWindow without reloading
Append HTML to wxHtmlWindow without reloading
Last edited by palacs on Mon Apr 15, 2019 6:29 pm, edited 1 time in total.
Re: Append HTML to wxHtmlWindow without reloading
Just to be clear: Don't mix up wxHtmlWindow and wxWebView. wxHtmlWindow uses wxWidgets' internal HTML parser which is limited and will be too slow for your purpose. wxWebView is a wrapper around the native browser on the respective platform.I would like to achieve that wxHtmlWindow loads...
I think that's exactly what you need to do....parses and draws only the appended part, same as document.write() JavaScript would do to an HTML document in a browser.
https://docs.wxwidgets.org/trunk/classw ... 5ef9fd0240
Use the source, Luke!
Re: Append HTML to wxHtmlWindow without reloading
Thanks. I know the difference between the two.
However, I would insist using wxHtmlWindow because it's much more resource-efficient when compiled with wxGTK. WebKit is slow, increases loading time and eats up a lot of memory. Basically I need text with basic formatting. Not CSS and JavaScript capabilities. Also, I find running extra javascript code an overkill. It needs to be parsed and run every time a log message arrives. You also need to take care of extra escaping of special characters. This would be a waste of resources. document.write() was just an example of the behavior I want, not an alternative.
So, to be clear, I want the same behavior of document.write() but in wxHtmlWindow. Appending without reloading.
However, I would insist using wxHtmlWindow because it's much more resource-efficient when compiled with wxGTK. WebKit is slow, increases loading time and eats up a lot of memory. Basically I need text with basic formatting. Not CSS and JavaScript capabilities. Also, I find running extra javascript code an overkill. It needs to be parsed and run every time a log message arrives. You also need to take care of extra escaping of special characters. This would be a waste of resources. document.write() was just an example of the behavior I want, not an alternative.
So, to be clear, I want the same behavior of document.write() but in wxHtmlWindow. Appending without reloading.
Re: Append HTML to wxHtmlWindow without reloading
I don't think you can get that. It will always parse the whole document if anything changes. And this will get pretty slow the bigger the HTML data gets.I want the same behavior of document.write() but in wxHtmlWindow. Appending without reloading.
wxRichTextCtrl will be too slow for lots of data, too.
Depending on what kind of formatting abilities you need, you should check wxStyledTextCtrl.
https://docs.wxwidgets.org/trunk/classw ... _ctrl.html
I still think wxWebView is your best option.
Use the source, Luke!
Re: Append HTML to wxHtmlWindow without reloading
Couldn't wxHtmlWindow source code be modified to re-parse and re-draw only the appended part?
Re: Append HTML to wxHtmlWindow without reloading
Hi,
Well, its an open source project.
You can do whatever.
And if you think it will be beneficial - send an e-mail to wx-dev to ask if this will be a good contribution to the library.
Keep in mind though that wxHtmlWindow supports very limited set of HTML4 tags and the best way of doing what you want is through the wxWebView, just like doublemax suggested.
Thank you.
Well, its an open source project.
You can do whatever.
And if you think it will be beneficial - send an e-mail to wx-dev to ask if this will be a good contribution to the library.
Keep in mind though that wxHtmlWindow supports very limited set of HTML4 tags and the best way of doing what you want is through the wxWebView, just like doublemax suggested.
Thank you.
Re: Append HTML to wxHtmlWindow without reloading
Theoretically: yes
Practically: Huge effort with no guarantee for success.
Use the source, Luke!