Flat look for Text widgets in a Form Editor [message #289490] |
Fri, 05 August 2005 12:23  |
Eclipse User |
|
|
|
Originally posted by: sebastien.alonzo.wanadoo.fr
I'm trying to develop a specific editor using FormEditor but I cannot
have my text widgets displayed with a flat look.
Here is a snippet of my code :
public class SubsystemForm extends FormPage {
[...]
/**
* Create Form content
*/
protected void createFormContent(IManagedForm managedForm) {
ScrolledForm form = managedForm.getForm();
FormToolkit toolkit = managedForm.getToolkit();
form.setText("Subsystem");
GridLayout layout = new GridLayout();
layout.numColumns = 2;
form.getBody().setLayout(layout);
[...]
Label descLbl = toolkit.createLabel(form.getBody(),
"subsystem.description", SWT.WRAP);
Text descTxt = toolkit.createText(form.getBody(), "", SWT.BORDER);
descTxt.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
[...]
}
[...]
}
From the samples I've seen, all text widgets have flat looks but I
cannot reproduce it. I'm running Eclipse 3.1 final ...
I'm probably missing something but I have not found any clue so far.
|
|
|
|
|
|
|
|
|
Re: Flat look for Text widgets in a Form Editor [message #289555 is a reply to message #289554] |
Mon, 08 August 2005 05:08  |
Eclipse User |
|
|
|
Originally posted by: sebastien.alonzo.wanadoo.fr
Roland Tepp wrote:
> You also need to add metadata to Your widgets that You want the border
> to be applied to:
>
> yourTextWidget.setData(FormToolkit.KEY_DRAW_BORDER,
> FormToolkit.TEXT_BORDER);
> or
> yourTableWidget.setData(FormToolkit.KEY_DRAW_BORDER,
> FormToolkit.TREE_BORDER);
>
> and then on the immediate parent composite of these widgets you should
> call:
> formToolkitInstance.paintPordersFor(yourParentComposite);
>
Thanks a lot Roland, now it works. I was almost there except that I
invoked paintBordersFor() on the form itself instead of its body which
is actually the immediate parent composite of my widget.
So the proper code that works for me is actually :
Text txt = toolkit.createText(form.getBody(), "", SWT.NONE);
txt.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
toolkit.paintBordersFor(form.getBody());
Thanks everybody for your help.
|
|
|
Powered by
FUDForum. Page generated in 0.04872 seconds