It works if I open a window first .... but i'd like to create the component before calling window.open loop rather than have to create it through an event.
What's the deal withat, any ideas ?
andySat 24 Apr 2010
That initial window.open call is whats initializing the current GfxEnv to SWT, which provides the implementation for things such as Font.width. Looks like you can workaround that by calling Desktop.bounds which will bind the GfxEnv as well.
tcolarTue 27 Apr 2010
Thanks that worked.
Also in RichTextPeer.java, there is:
// this is a hack, but seems to be the only way to set
// the margins hidden away as private fields in StyledText
setField(t, "leftMargin", 8);
setField(t, "topMargin", 0);
setField(t, "rightMargin", 8);
setField(t, "bottomMargin", 8);
Any reason why that stuff(margins) is hidden/hard-coded in the Java rather than configurable ?
At first I thought it might make JavaScript compatibility easier .. but it seem Richtext is not even implemented in Javascript anyway (empty file)
tcolar Sat 24 Apr 2010
I'm trying to make my own UI component I'm using font.width to calculate it's size but unless a windows is already open I get this error:
sys::Err: No GfxEnv is active
.....
It works if I open a window first .... but i'd like to create the component before calling window.open loop rather than have to create it through an event.
What's the deal withat, any ideas ?
andy Sat 24 Apr 2010
That initial
window.open
call is whats initializing the current GfxEnv to SWT, which provides the implementation for things such asFont.width
. Looks like you can workaround that by callingDesktop.bounds
which will bind the GfxEnv as well.tcolar Tue 27 Apr 2010
Thanks that worked.
Also in RichTextPeer.java, there is:
Any reason why that stuff(margins) is hidden/hard-coded in the Java rather than configurable ?
At first I thought it might make JavaScript compatibility easier .. but it seem Richtext is not even implemented in Javascript anyway (empty file)