Lazarus

Programming => General => Topic started by: speter on May 21, 2021, 06:06:49 am

Title: displaying a "page" with images and text
Post by: speter on May 21, 2021, 06:06:49 am
G'Day Folks,

I want to displaying a "page" with images and text, on a form (probably in a memo-like component). ;)

I was thinking of using a component that renders HTML; but most seem to implement a web browser, so they include code for connecting to a web server etc.

Can anyone suggest a better alternative?

The content doesn't exist yet (I'll write it over the next couple of months); but it is intended as a "help" form (for a game).

At present, the simplest methodology appears to be to use opendocument() (https://wiki.freepascal.org/opendocument (https://wiki.freepascal.org/opendocument)) to open a browser (or pdf viewer).

cheers
S.
Title: Re: displaying a "page" with images and text
Post by: wp on May 21, 2021, 10:58:07 am
Do you want to display that page within your Lazarus application?

You could use the IpHtmlPanel which comes with Lazarus and displays html; there are some examples in the components/turbopower_ipro and examples/turbopower_ipro folders. Since the usage of images is a bit too complicated in these examples I added a small sample project. You should be aware, though, that the usage of external css files does not seem to be supported - I had to move the css into the main html files. And there are also some bugs here and there, but for simple tasks it is sufficient.

Alternatively you could use a RichEdit component such as TRichMemo which you can install via Online-Package-Manager.
Title: Re: displaying a "page" with images and text
Post by: speter on May 21, 2021, 11:42:46 am
Do you want to display that page within your Lazarus application?
Ideally I'd like the content displayed on a form within the application. But (of course) if I use opendocument it won't be like that.

You could use the IpHtmlPanel which comes with Lazarus and displays html; there are some examples in the components/turbopower_ipro and examples/turbopower_ipro folders. Since the usage of images is a bit too complicated in these examples I added a small sample project. You should be aware, though, that the usage of external css files does not seem to be supported - I had to move the css into the main html files. And there are also some bugs here and there, but for simple tasks it is sufficient.

Alternatively you could use a RichEdit component such as TRichMemo which you can install via Online-Package-Manager.

Thanks very much, I'll check it out.

cheers
S.
Title: Re: displaying a "page" with images and text
Post by: fred on May 21, 2021, 01:04:09 pm
You could take a look at https://wiki.freepascal.org/TECLightView
It has limits like vertical scrollbar only but perhaps you can use it.
Title: Re: displaying a "page" with images and text
Post by: speter on May 22, 2021, 06:08:33 am
Many thanks to wp and fred.

I think I'll use TECLightView; it seems to be a really nice and simple way of mixing text and images in a memo-like component.

cheers
S.
TinyPortal © 2005-2018