CSS & Layouts [message #1384799] |
Mon, 02 June 2014 03:14  |
Eclipse User |
|
|
|
How can I calculate some layout sizes based on the font size of the widgets, eg size columns in table widgets or the width and height of text widgets depending on the widgets fonts?
For example, consider this (old code):
Text text = new Text(parent, SWT.NONE);
text.setFont(textFont);
int averageCharWidth = textFont.getFontData()[0].getFontMetrics().getAverageCharWidth();
GridDataFactory.fillDefaults().hint(30 * averageCharWidth, SWT.DEFAULT).applyTo(text);
In e4, I will not set the font directly, it will be applied later by the css engine. How can I size the control?
Thanks,
Peter
|
|
|
Re: CSS & Layouts [message #1384816 is a reply to message #1384799] |
Mon, 02 June 2014 05:50   |
Eclipse User |
|
|
|
Hi,
I'm not 100% but could you try to register an SWT-Listener who listens
to SWT.Skin?
Tom
On 02.06.14 09:15, Peter Kullmann wrote:
> How can I calculate some layout sizes based on the font size of the
> widgets, eg size columns in table widgets or the width and height of
> text widgets depending on the widgets fonts?
> For example, consider this (old code):
>
> Text text = new Text(parent, SWT.NONE);
> text.setFont(textFont);
> int averageCharWidth =
> textFont.getFontData()[0].getFontMetrics().getAverageCharWidth();
> GridDataFactory.fillDefaults().hint(30 * averageCharWidth,
> SWT.DEFAULT).applyTo(text);
>
>
> In e4, I will not set the font directly, it will be applied later by the
> css engine. How can I size the control?
>
> Thanks, Peter
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.25291 seconds