RichText in Gambas

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RichText in Gambas

Rolf-Werner Eilert-2
Is there an information about the RichText property? I mean, which HTML
tags are accepted etc.?

I could imagine at least Benoit should know where to get information
about it.

In my GridView example, I tried RichText for the cell. Pure font style
tags run well, like bold, italics etc. But I had a problem with center.

<div align=center> results in not showing the text in the cell at all.

Same thing happens if I try GridView1.Data.Alignment = Align.Center and
then give RichText.

When I use simple Text instead, Align.Center will run. But then I cannot
vary the fontstyles anymore...

Any idea how to solve this?

Regards
Rolf



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: RichText in Gambas

Tobias Boege-2
On Mon, 10 Jul 2017, Rolf-Werner Eilert wrote:
> Is there an information about the RichText property? I mean, which HTML tags
> are accepted etc.?
>

GridView is in gb.gui.base (written in Gambas) and you can see that it uses
the Paint class to draw its cells. To draw RichText it uses Paint.DrawRichText().
If you use gb.qt4 as Paint backend you can trace its source code to see that
ultimately rich text is put into a QTextDocument (by setHTML()) and drawn from
there. The supported HTML is then documented over at QT [1].

> I could imagine at least Benoit should know where to get information about
> it.
>
> In my GridView example, I tried RichText for the cell. Pure font style tags
> run well, like bold, italics etc. But I had a problem with center.
>
> <div align=center> results in not showing the text in the cell at all.
>
> Same thing happens if I try GridView1.Data.Alignment = Align.Center and then
> give RichText.
>
> When I use simple Text instead, Align.Center will run. But then I cannot
> vary the fontstyles anymore...
>
> Any idea how to solve this?
>

The GridViewData.Alignment seems to be passed to the DrawRichText() call
and, at least in gb.qt4, the rich text drawing routine constructs an
alignment div out of the Alignment parameter, so I don't know what the
problem is. You could try the <center> tag?

Regards,
Tobi

[1] https://doc.qt.io/qt-4.8/richtext-html-subset.html

--
"There's an old saying: Don't change anything... ever!" -- Mr. Monk

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Loading...