TableColumn and Table Fonts [message #988909] |
Mon, 03 December 2012 16:32 |
|
I see that the .SetFont method is not available/implemented for TableColumn objects.
This is the same in SWT as RWT/RAP.
Ok, but in SWT, if I use .SetFont on the Table itself, that font is also used for the TableColumn headers. I would like to duplicate this behaviour in RWT/RAP, but presently the TableColumn header appears to be using the default theme font rather than honouring, or inheriting the Table's font.
Is this deliberate behaviour, or should the TableColumn inherit the Table's font?
As it is a difference between SWT vs RWT/RAP, it is not desirable, as I want to single-source my application for both targets.
I don't particularly want to resort to CSS theme in this instance, although I see that this is a possible solution - my application is structured such that programmatic setting of Table (and thus TableColumn) fonts is a requirement.
Is it a bug, deliberate, or just a planned difference?
Any ideas appreciated!
John
---
Just because you can doesn't mean you should
|
|
|
Re: TableColumn and Table Fonts [message #989226 is a reply to message #988909] |
Wed, 05 December 2012 09:52 |
Tim Buschtoens Messages: 396 Registered: July 2009 |
Senior Member |
|
|
Hi.
Differences between SWT and RWT are rarely deliberate. Could you please
open an entry on the RAP Bugzilla for this? Thanks!
Also, what RAP version are you working on?
Greetings,
Tim
Am 03.12.2012 17:32, schrieb John Gymer:
> I see that the .SetFont method is not available/implemented for
> TableColumn objects.
>
> This is the same in SWT as RWT/RAP.
>
> Ok, but in SWT, if I use .SetFont on the Table itself, that font is also
> used for the TableColumn headers. I would like to duplicate this
> behaviour in RWT/RAP, but presently the TableColumn header appears to be
> using the default theme font rather than honouring, or inheriting the
> Table's font.
>
> Is this deliberate behaviour, or should the TableColumn inherit the
> Table's font?
>
> As it is a difference between SWT vs RWT/RAP, it is not desirable, as I
> want to single-source my application for both targets.
>
> I don't particularly want to resort to CSS theme in this instance,
> although I see that this is a possible solution - my application is
> structured such that programmatic setting of Table (and thus
> TableColumn) fonts is a requirement.
>
> Is it a bug, deliberate, or just a planned difference?
> Any ideas appreciated!
> John
>
>
--
Tim Buschtöns
Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/
Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
|
|
|
|
|
Re: TableColumn and Table Fonts [message #989241 is a reply to message #989238] |
Wed, 05 December 2012 10:36 |
|
Thanks Ralf... found it... raised!
Actually raised a couple of other points in there too (related under the same bug report), as my example highlighted some work-arounds that I've put in place to get around other differences... these are detailed in the bug report, but just for completeness I thought it may be useful to add them here too...
...
fontData = new FontData();
if (runningAsSWT)
fontData.height = myFontSize;
else {
fontData.setHeight(myFontSize+RWTFontAdjust);
}
fontData.setStyle(myFontStyle);
fontData.setName(myFontType);
font = new Font(display, fontData);
myTable.setFont(font);
...
Point 1: Note how with SWT I have to use the .height property, but with RWT/RAP I need to use the .setHeight() method (RWT will take exception if I try to use .height property).
Point 2: Note how I am adjusting the font size for RWT by adding a fixed amount (RWTFontAdjust variable) because SWT appears to use 'pt' and RWT appears to use 'px', which are not the same. My solution appears to be ok for some browsers and some DPIs, but not all... so it would be good to know if there is a better calculation to use here?
Thanks, John
---
Just because you can doesn't mean you should
|
|
|
|
Re: TableColumn and Table Fonts [message #989535 is a reply to message #989252] |
Thu, 06 December 2012 16:28 |
|
On 12/05/2012 12:02 PM, John Gymer wrote:
> Actually, quite amendment to Point 1... it seems that .setHeight()
> method works ok in SWT and RWT. It is only .height property that doesn't
> work. That's fine - I'll just use .setHeight() for everything!
You should not use the height property in SWT as well. The JavaDoc
clearly states: "<b>IMPORTANT:</b> This field is <em>not</em> part of
the SWT public API ..."
Regards, Ralf
--
Ralf Sternberg
Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/
Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
|
|
|
Powered by
FUDForum. Page generated in 0.04514 seconds