Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[nebula-dev] DateChooserCombo and different windows themes

Hi all,

I'm currently experiencing some problems with the nebula DateChooserCombo and different Windows Themes. The scenario a simple editor with different controls arranged by a gridlayout. When I switch between the windows theme "Windows XP" and "Windows Classic" (via display properties -> themes/appearance) the spacing between the regular SWT controls and the DateChooser combo behaves different (see screenshot: http://pellepelster.de/datechoosercombo.png or example code at the bottom). Is there anything I can do to avoid this behaviour?


Regards,

   Christian

---
example code:

package rcpspielwiese.editors;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.nebula.widgets.datechooser.DateChooserCombo;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.part.EditorPart;

import com.swtdesigner.ResourceManager;

public class TestEditor1 extends EditorPart {

	private ScrolledForm scrolledForm;
	private Text text;
	private Text text_1;
	private Text text_2;
	public static final String ID = "rcpspielwiese.editors.TestEditor1"; //$NON-NLS-1$

	/**
	 * Create contents of the editor part
	 * 
	 * @param parent
	 */
	@Override
	public void createPartControl(Composite parent) {
		final FormToolkit toolkit = ResourceManager.getFormToolkit();
		toolkit.adapt(parent);

		scrolledForm = toolkit.createScrolledForm(parent);
		toolkit.adapt(scrolledForm);
		toolkit.paintBordersFor(scrolledForm);
		final Composite body = scrolledForm.getBody();
		toolkit.adapt(body);
		final GridLayout gridLayout = new GridLayout();
		gridLayout.numColumns = 2;
		body.setLayout(gridLayout);
		toolkit.paintBordersFor(body);

		toolkit.createLabel(body, "Label1", SWT.NONE);

		text = toolkit.createText(body, null, SWT.NONE);
		text.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false));

		toolkit.createLabel(body, "Label2", SWT.NONE);

		text_1 = toolkit.createText(body, null, SWT.NONE);
		text_1.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false));

		toolkit.createLabel(body, "Label3", SWT.NONE);

		DateChooserCombo date1 = new DateChooserCombo(body, SWT.FLAT);
		date1.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
		toolkit.adapt(date1);
		toolkit.paintBordersFor(date1);
		date1.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false));

		toolkit.createLabel(body, "Label4", SWT.NONE);

		DateChooserCombo date2 = new DateChooserCombo(body, SWT.FLAT);
		date2.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
		toolkit.adapt(date2);
		toolkit.paintBordersFor(date2);
		date2.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false));

		toolkit.createLabel(body, "Label5", SWT.NONE);

		text_2 = toolkit.createText(body, null, SWT.NONE);
		text_2.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false));

	}

	@Override
	public void doSave(IProgressMonitor monitor) {
		// Do the Save operation
	}

	@Override
	public void doSaveAs() {
		// Do the Save As operation
	}

	@Override
	public String getTitleToolTip() {
		return "TestEditor1";
	}

	@Override
	public void init(IEditorSite site, IEditorInput input) throws PartInitException {
		setSite(site);
		setInput(input);
		setPartName("TestEditor1");
	}

	@Override
	public boolean isDirty() {
		return false;
	}

	@Override
	public boolean isSaveAsAllowed() {
		return false;
	}

	@Override
	public void setFocus() {
		// Set the focus
	}

}


Christian Pelster
Consultant
 
Lufthansa Systems
Business Unit Logistic
Schützenwall 1
22844 Norderstedt
Germany
 
Tel: 	+49(0)151 58920040
Fax: 	+49(0)40 5070 7880

E-mail:  	christian.pelster@xxxxxxxxxxxxx
Internet: 	www.LHSystems.com
	
Sitz der Gesellschaft/Corporate Headquarters:
Lufthansa Systems, Norderstedt
 
Registereintragung/Registration:
Amtsgericht Norderstedt HRB 3688 
 
Geschäftsführer/Managing Directors:
Bernd Appel



 
Sitz der Gesellschaft / Corporate Headquarters: Lufthansa Systems AS GmbH, Norderstedt, Registereintragung / Registration: Amtsgericht Kiel 3688NO
Geschaeftsfuehrung / Management Board: Bernd Appel




Back to the top