Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Flat look for Text widgets in a Form Editor
Flat look for Text widgets in a Form Editor [message #289490] Fri, 05 August 2005 16:23 Go to next message
Eclipse UserFriend
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 #289498 is a reply to message #289490] Fri, 05 August 2005 17:41 Go to previous messageGo to next message
Steve Blass is currently offline Steve BlassFriend
Messages: 276
Registered: July 2009
Senior Member
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
Re: Flat look for Text widgets in a Form Editor [message #289501 is a reply to message #289490] Fri, 05 August 2005 19:39 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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 #289550 is a reply to message #289490] Mon, 08 August 2005 08:11 Go to previous messageGo to next message
Stephen Rowles is currently offline Stephen RowlesFriend
Messages: 14
Registered: July 2009
Junior Member
As posted by another person in the thread, remove the SWT.BORDER from
the creation of the text box as shown below, and replace it with SWT.NONE

so...

Text descTxt = toolkit.createText(form.getBody(), "", SWT.NONE);

SWT.BORDER will cause the text box to have a "3d drop" border to it.

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 :
> Text descTxt = toolkit.createText(form.getBody(), "", SWT.BORDER);
Re: Flat look for Text widgets in a Form Editor [message #289554 is a reply to message #289543] Mon, 08 August 2005 09:02 Go to previous messageGo to next message
Roland Tepp is currently offline Roland TeppFriend
Messages: 336
Registered: July 2009
Senior Member
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);

Sébastien Alonzo kirjutas mulle ühel talvisel päeval midagi seesugust:
> 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 ?

--
Roland Tepp
Re: Flat look for Text widgets in a Form Editor [message #289555 is a reply to message #289554] Mon, 08 August 2005 09:08 Go to previous message
Eclipse UserFriend
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.
Previous Topic:About bootdelegation
Next Topic:building help search index
Goto Forum:
  


Current Time: Thu Apr 18 11:03:17 GMT 2024

Powered by FUDForum. Page generated in 0.02289 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top