Could TRichEdit substitute for a local browser?

General TRichView support forum. Please post your questions here
Post Reply
VicFan
Posts: 9
Joined: Sun Jul 28, 2019 8:34 pm

Could TRichEdit substitute for a local browser?

Post by VicFan » Sun Jul 28, 2019 9:04 pm

I have a project that a prototype was created as a webpage, but ran into the problem that the TBrowser control in C++ Builder only allows 1 instance in each project and this needs to be multiple pages, each with their own browser. The fundamental requirements are:

- Works like an unlimited length document (i.e., like a web page, but doesn't need all the overhead like web communications, data to fill in the browser is actually coming from a local database)

- Has to allow multiple pages, each page with its own document, changing between pages keeps the last shown location within the document when returning to the page (again, like a general web browser that has multiple pages open)

- able to format documents with what would look multi-column tables without borders, word-wrapping within each cell and setting the height of cells dynamically to the tallest cell in each row (like an HTML TD)

- each cell can have multiple text formatting (like a mixture of various fonts within a single cell)

- at various points in the document, a button appears rather than multiple rows of the document. When the button is pressed, the button is hidden and the rows of text are unhidden. (In the prototype, this was done with javascript changing the visibility of a block of text and the button. This sounds like what I am reading your Actions do?)

Would TRichEdit do all the above? Any short samples that demo some or all the above?

Sergey Tkachenko
Site Admin
Posts: 14513
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Could TRichEdit substitute for a local browser?

Post by Sergey Tkachenko » Mon Jul 29, 2019 8:47 am

I think you can use TRichView.
- Works like an unlimited length document (i.e., like a web page, but doesn't need all the overhead like web communications, data to fill in the browser is actually coming from a local database)
No problems with unlimited length document. The problem may be with document formats stored in a database, I'll describe it below.
- Has to allow multiple pages, each page with its own document, changing between pages keeps the last shown location within the document when returning to the page (again, like a general web browser that has multiple pages open)
You can place multiple TRichView controls in TPageControl (or you can use TTabControl and reload TRichView content and set the stored scrolling position, but it is more difficult).
- able to format documents with what would look multi-column tables without borders, word-wrapping within each cell and setting the height of cells dynamically to the tallest cell in each row (like an HTML TD)
TRichView has tables similar to HTML, they can be borderless. You can test tables in out ActionTest project (Table | Insert Table command, then Table | Table Properties to hide borders). The editor shows grid lines in places of hidden borders, but they can be turned off.
- each cell can have multiple text formatting (like a mixture of various fonts within a single cell)
No problem.
- at various points in the document, a button appears rather than multiple rows of the document. When the button is pressed, the button is hidden and the rows of text are unhidden. (In the prototype, this was done with javascript changing the visibility of a block of text and the button. This sounds like what I am reading your Actions do?)
This is not a standard functionality, but it can be implemented. See the topic https://www.trichview.com/forums/viewtopic.php?f=3&t=62 . The most appropriate example is the last one (that shows/hides content using "hidden text" feature).

Do you have a database of existing documents that you need to display? If you only plan to create it, you can use TRichViewEdit/TDBRichViewEdit and store documents in our native RVF format (you can always export them to HTML, RTF, or DocX when you need).
If you have an existing database or storing as HTML is a requirement, it may be a problem. TRichView does not have method for loading HTML directly. There are additional free components (TrvHtmlImporter, or, better, TrvHtmlViewImporter) that allow to do it, but the result may be imperfect for complex HTML. And definitely, JavaScript is not supported.

Post Reply