Page 1 of 1

HTML support

Posted: Tue Sep 11, 2012 2:59 am
by potentiometer
I am currently using the former David Baldwin's THTMLViewer component, but since it is no longer supported, I am considering switching to an alternative.

I have download the trial components, but I fail to find any demo project that shows what TRichView is capable of doing with respect to HTML documents. Am I simply overlooking a demo?

I am looking for a component that will:

Code: Select all

1) Display HTML from either an existing file or on-the-fly within the application: E.g.,  DisplayThisHTMLNow('<html><body>testing 123</body></html>');

2) Supports mouse wheel scrolling

3) Can display <a href> hyperlinks without underlining them.

4) Provides the URL of a hyperlink via an event when the mouse hovers over the hyperlink.

5) Can adjust the top/bottom/side margins using a property value

6) Can provide information about the text and/or tags that are nearest to the top of the component.  IOW, if a HTML file is loaded, and the user scrolls halfway down the document where on the top visible line there is a <tag>, can one retrieve information about either that top visible line and/or the tags on that line?

7) Can a change be made to an already loaded HTML file, such as inserting a pair of <b></b> tags around a word, and then redrawing the document without causing the document to jump to the beginning?  IOW, if the user has scrolled halfway through the document, and I wish to on-the-fly change a word so as to emphasize/bold it, can this be done?  IOW, make the word appear bold on-the-fly, without causing the vertical scroll position to be reset to 0?

Posted: Fri Sep 14, 2012 7:05 am
by Sergey Tkachenko
THTMLViewer is now maintained here: http://code.google.com/p/thtmlviewer/
So, if you does not need editing features, you may considering continuing using it.

As for our components, unfortunately, they do not have methods for loading HTML (we plan to implement them till the end of this year, but it could take longer).
Currently, the best way to import HTML in our components is reading them in THTMLViewer, then importing from THTMLViewer to TRichView using TrvHtmlViewImporter, http://www.trichview.com/resources/

Note 1: TRichView is not a specialized HTML editor/viewer, so it does not support many HTML features. For example, it uses a "flat" model, like MS Word (two levels: paragraphs and text), instead of multiple nested <div> in HTML.
Note 2: after importing, the original HTML tags cannot be restored.

As for your requirements
1) Using THTMLViewer
2) Mouse wheel is supported.
3) Attributes of hyperlinks are defined like attributes of normal text (with possible additional attributes for highlighting below the mouse pointer)
4) OnRVMouseMove event
5) LeftMargin, TopMargin, etc. properties
6) FirstItemVisible property, then methods retrieving info about items (GetItemStyle, etc.)
7) TRichViewEdit is a rich text editor, you can apply changes to the selected fragment (if necessary, you can use SelectCurrentWord or SelectWordAt). However, as I said, it is not a specialized HTML editor, it does not work in terms of <b></b>. It just can make words bold.