Recent

Author Topic: displaying a "page" with images and text  (Read 2158 times)

speter

  • Sr. Member
  • ****
  • Posts: 349
displaying a "page" with images and text
« 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) to open a browser (or pdf viewer).

cheers
S.
« Last Edit: May 21, 2021, 06:11:13 am by speter »
I climbed mighty mountains, and saw that they were actually tiny foothills. :)

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: displaying a "page" with images and text
« Reply #1 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.

speter

  • Sr. Member
  • ****
  • Posts: 349
Re: displaying a "page" with images and text
« Reply #2 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.
I climbed mighty mountains, and saw that they were actually tiny foothills. :)

fred

  • Full Member
  • ***
  • Posts: 201
Re: displaying a "page" with images and text
« Reply #3 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.

speter

  • Sr. Member
  • ****
  • Posts: 349
Re: displaying a "page" with images and text
« Reply #4 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.
I climbed mighty mountains, and saw that they were actually tiny foothills. :)

 

TinyPortal © 2005-2018