Disabled Text inside a form, the border doesn't show [message #436599] |
Tue, 13 September 2005 13:52 |
Eclipse User |
|
|
|
Originally posted by: carvalho_ruben.yahoo.co.uk
Hello everyone,
I'm going crazy on this. I have a Text box inside a Form and I want it to
start disabled (text.setEnabled(false)). The problem is I want the Text
box to have a flat border but it insists in not showing. Here's a Snippet.
I'm using it inside a WizardPage, in createControl(Composite parent) method
public void createControl(Composite parent) {
FormToolkit toolkit = new FormToolkit(parent.getDisplay());
ScrolledForm form = toolkit.createScrolledForm(parent);
form.getBody().setLayout(new FillLayout());
Composite comp = toolkit.createComposite(form.getBody());
GridLayout gl = new GridLayout(2, false);
comp.setLayout(gl);
Label label = toolkit.createLabel(comp, "Label: ");
Text text = toolkit.createText(comp, "");
toolkit.paintBordersFor(comp);
label.setEnabled(false);
text.setEnabled(false);
setControl(comp);
}
I've tried so many different things, looked to every post and can't find a
solution. Any help please?
Thanks in advance.
|
|
|
Re: Disabled Text inside a form, the border doesn't show [message #436605 is a reply to message #436599] |
Tue, 13 September 2005 17:08 |
Chris Gross Messages: 471 Registered: July 2009 |
Senior Member |
|
|
Its a design decision in the UI Forms code. I'm not quite sure why but
they do not draw the flat border around disabled Text widgets. You'll
need to wrap your Text field in a composite, setData on the composite
with the correct info to mark it for a border, then paintBordersFor.
Sorry I don't remember the setData info that you'll need to mark it for
a border, search around.
-Chris
Ruben Carvalho wrote:
> Hello everyone,
>
> I'm going crazy on this. I have a Text box inside a Form and I want it
> to start disabled (text.setEnabled(false)). The problem is I want the
> Text box to have a flat border but it insists in not showing. Here's a
> Snippet. I'm using it inside a WizardPage, in createControl(Composite
> parent) method
>
> public void createControl(Composite parent) {
> FormToolkit toolkit = new FormToolkit(parent.getDisplay());
> ScrolledForm form = toolkit.createScrolledForm(parent);
> form.getBody().setLayout(new FillLayout());
>
> Composite comp = toolkit.createComposite(form.getBody());
>
> GridLayout gl = new GridLayout(2, false);
> comp.setLayout(gl);
>
> Label label = toolkit.createLabel(comp, "Label: ");
>
> Text text = toolkit.createText(comp, "");
>
> toolkit.paintBordersFor(comp);
>
> label.setEnabled(false);
> text.setEnabled(false);
>
> setControl(comp);
> }
>
> I've tried so many different things, looked to every post and can't find
> a solution. Any help please?
>
> Thanks in advance.
>
|
|
|
Powered by
FUDForum. Page generated in 0.03314 seconds