Hi Isomorphic,
please see this sample (v12.0p_2019-03-23) and how different the same class looks as Window and as Print preview.
IMHO there is something wrong with HLayout positioning.

BuiltInDS.java:
Also, is it somehow possible to get the contents of the print preview Canvas in the Developer Console Watch-tab, like for Window? Please see the screenshot.
This would make debugging way more easy.

Best regards
Blama
please see this sample (v12.0p_2019-03-23) and how different the same class looks as Window and as Print preview.
IMHO there is something wrong with HLayout positioning.
BuiltInDS.java:
Code:
package com.smartgwt.sample.client;
import com.google.gwt.core.client.EntryPoint;
import com.smartgwt.client.core.KeyIdentifier;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.util.Page;
import com.smartgwt.client.util.PageKeyHandler;
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.Window;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.VLayout;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class BuiltInDS implements EntryPoint {
/**
* This is the entry point method.
*/
public void onModuleLoad() {
KeyIdentifier debugKey = new KeyIdentifier();
debugKey.setCtrlKey(true);
debugKey.setKeyName("D");
Page.registerKey(debugKey, new PageKeyHandler() {
public void execute(String keyName) {
SC.showConsole();
}
});
final HLayout labelHL = new HLayout() {
{
setHeight(25);
Label lb1 = new Label("label one");
lb1.setAlign(Alignment.LEFT);
lb1.setWidth100();
Label lb2 = new Label("label two");
lb2.setAlign(Alignment.CENTER);
lb2.setWidth100();
Label lb3 = new Label("label three");
lb3.setAlign(Alignment.RIGHT);
lb3.setWidth100();
addMembers(lb1, lb2, lb3);
}
};
final HLayout dynamicHL = new HLayout() {
{
DynamicForm df1 = new DynamicForm();
df1.setWidth100();
TextItem ti1 = new TextItem();
ti1.setValue("text one");
df1.setFields(ti1);
DynamicForm df2 = new DynamicForm();
df2.setWidth100();
TextItem ti2 = new TextItem();
ti2.setValue("text two");
df2.setFields(ti2);
addMembers(df1, df2);
}
};
IButton windowButton = new IButton("Window");
windowButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
Window testWindow = new Window() {
{
setHeight100();
setWidth100();
setOverflow(Overflow.AUTO);
setTitle("Test window");
}
};
testWindow.addItem(labelHL);
testWindow.addItem(dynamicHL);
testWindow.show();
testWindow.focus();
}
});
IButton printPreviewButton = new IButton("Print preview");
printPreviewButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
Object[] components = { labelHL, dynamicHL };
Canvas.showPrintPreview(components);
};
});
VLayout mainLayout = new VLayout();
mainLayout.addMembers(windowButton, printPreviewButton);
mainLayout.show();
}
}
This would make debugging way more easy.
Best regards
Blama
Comment