Flat look for Text widgets in a Form Editor [message #289490] |
Fri, 05 August 2005 16: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 #289501 is a reply to message #289490] |
Fri, 05 August 2005 19:39 |
Eclipse User |
|
|
|
Originally posted by: lorenz.m.gmx.at
HI,
don't specify SWT.BORDER - this creates the native (non-flat) border and
disables the form-specific border drawing.
Sébastien Alonzo wrote:
> 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 #289542 is a reply to message #289498] |
Mon, 08 August 2005 07:13 |
Eclipse User |
|
|
|
Originally posted by: sebastien.alonzo.wanadoo.fr
Steve Blass wrote:
> Sébastien Alonzo wrote:
>
>> 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.
>
>
> Did you call toolkit.paintBordersFor(form) ? That should give you the
> flat look.
>
> -
> Steve
I did, but it doesn't change anything ... do you have an example of code
that works so I can compare with my own ?
|
|
|
Re: Flat look for Text widgets in a Form Editor [message #289543 is a reply to message #289501] |
Mon, 08 August 2005 07:16 |
Eclipse User |
|
|
|
Originally posted by: sebastien.alonzo.wanadoo.fr
Lorenz Maierhofer wrote:
> HI,
>
> don't specify SWT.BORDER - this creates the native (non-flat) border and
> disables the form-specific border drawing.
>
Hi Lorenz,
When I don't specify SWT.BORDER (e.g. using only SWT.SINGLE as style) I
don't have any border at all. Even if I invoke toolkit.paintBordersFor(form)
Do you an example of code that so that I can compare with my own ?
|
|
|
|
|
Re: Flat look for Text widgets in a Form Editor [message #289555 is a reply to message #289554] |
Mon, 08 August 2005 09: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.02289 seconds