Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg
Paul.Helster wrote:1- Form composites do not get adapted to the toolkit. If I create a composite, and then add a FormToolkit instance construction to the composite constructor, the composite itself is not adapted to the toolkit settings. In particular, the background is not white. Callint toolkit.adapt(this) has no effect.
Paul.Helster wrote:2- I need to call toolkit.paintComponentBorders(this) in the composite so that children controls be drawn with borders.
Paul.Helster wrote:3- If I "choose the composite" created with #1 and #2 workarounds, and add it to another composite, the borders of the embedded custom component do not get painted. The container composite is setup to use a FormToolkit, and I called here too paintComponentBorders.
package test;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Section;
public class TestCustom extends Composite {
private Text text;
public TestCustom(Composite parent, int style) {
super(parent, style);
setLayout(new FormLayout());
FormToolkit toolkit = new FormToolkit(Display.getCurrent());
toolkit.adapt(this);
toolkit.paintBordersFor(this);
final Composite composite = toolkit.createComposite(this, SWT.NONE);
final FormData formData = new FormData();
formData.bottom = new FormAttachment(0, 210);
formData.right = new FormAttachment(0, 365);
formData.top = new FormAttachment(0, 80);
formData.left = new FormAttachment(0, 90);
composite.setLayoutData(formData);
composite.setLayout(new FormLayout());
toolkit.paintBordersFor(composite);
text = toolkit.createText(composite, null, SWT.NONE);
final FormData formData_1 = new FormData();
formData_1.bottom = new FormAttachment(0, 57);
formData_1.right = new FormAttachment(0, 190);
formData_1.top = new FormAttachment(0, 40);
formData_1.left = new FormAttachment(0, 82);
text.setLayoutData(formData_1);
text.setText("New Forms Text");
//
}
public void dispose() {
super.dispose();
}
protected void checkSubclass() {
}
}
package test;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.forms.widgets.FormToolkit;
public class Test extends Composite {
public Test(Composite parent, int style) {
super(parent, style);
FormToolkit toolkit = new FormToolkit(parent.getDisplay());
toolkit.adapt(this);
toolkit.paintBordersFor(this);
setLayout(new FormLayout());
final TestCustom testCustom = new TestCustom(this, SWT.NONE);
final FormData formData = new FormData();
formData.top = new FormAttachment(0, 40);
formData.left = new FormAttachment(0, 35);
testCustom.setLayoutData(formData);
}
public void dispose() {
super.dispose();
}
protected void checkSubclass() {
}
}
Paul.Helster wrote:I noticed that it is easier to reproduce this problem than what I suggested above.
1- Create a new Composite.
2- Add the FormToolkit instantiation.
3- Add a composite inside.
4- Add a Text to this embedded composite.
The text will not have borders.
Paul.Helster wrote:But the sad part is when I embed it as a Custom Control: Borders do not get drawn, and the background problem is back (i.e. the background of the custom composite is now grey.) This was fixed in the last build but the problem is back.
Paul.Helster wrote:One minor issue: the fix is complete for the designer view, but the problems are still present in the "Quick preview".
Users browsing this forum: No registered users and 1 guest