Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Disabled Text inside a form, the border doesn't show
Disabled Text inside a form, the border doesn't show [message #436599] Tue, 13 September 2005 13:52 Go to next message
Eclipse UserFriend
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 Go to previous message
Chris Gross is currently offline Chris GrossFriend
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.
>
Previous Topic:Add default perspectives
Next Topic:TreeViewer only showing one level
Goto Forum:
  


Current Time: Mon Dec 02 22:24:27 GMT 2024

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

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

Back to the top