The following code causes a “this.getStyleHandle() is null” exception - but only when I view the compiled code (I tried both IE 7 and FF 3). Running it in GWT’s hosted browser works fine.
public void onModuleLoad() {
IButton btnCreatePkg = new IButton("Click me");
btnCreatePkg.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
Window wnd = new Window();
Label lblTitle = new Label();
wnd.addItem(lblTitle);
lblTitle.setMargin(5); // <=== This line causes the error
wnd.show();
}
});
RootPanel.get().add(btnCreatePkg);
}
When I call SmartClient via its JavaScript interface directly, I don’t get the error:
<SCRIPT>
isc.IButton.create({
title:"Click me",
click:"btnClick()"
});
function btnClick() {
wnd = isc.Window.create({});
lbl=isc.Label.create();
lbl.setContents("Hello");
wnd.addItem(lbl);
lbl.setMargin(5);
return wnd;
}
</SCRIPT>
I use GWT 1.5.3 on Windows, and the latest nightly build of SmartGWT.