| TextBoxes [message #279548] |
Wed, 19 January 2005 11:56  |
Eclipse User |
|
|
|
I want to create a textbox in a group that spans 4 rows. I have tried many
things, but I can't get the text box to be more than one row high.
Here is how I'm creating the box:
group = new Group(composite, SWT.NONE);
group.setText(groupTitle);
layout = new GridLayout();
layout.horizontalSpacing = 15;
layout.numColumns = 1;
group.setLayout(layout);
gridData = new GridData(GridData.FILL_BOTH |
GridData.VERTICAL_ALIGN_CENTER);
gridData.verticalSpan = 4;
group.setLayoutData(gridData);
text = new Text(group, SWT.MULTI | SWT.V_SCROLL | SWT.WRAP);
gridData = new GridData(GridData.FILL_BOTH);
gridData.verticalSpan = 4;
text.setLayoutData(gridData);
What am I doing wrong?
|
|
|
|
|
|
|
| Re: TextBoxes [message #279707 is a reply to message #279696] |
Fri, 21 January 2005 16:33  |
Eclipse User |
|
|
|
Originally posted by: Chris_Laffra.ca.ibm.com
Something like this should work:
int lineHeight = text.getLineHeight();
gridData.heightHint = 4*lineHeight;
text.setLayoutData(gridData);
--
Chris Laffra, http://eclipsefaq.org
"Shawn L. Pecze" <pecze@us.ibm.com> wrote in message
news:csreo5$81f$1@www.eclipse.org...
> How do I tell the text to occumpy 4 lines? I thought I was doing that by
> creating a GridData object and setting the vertical span to 4 and then
> setting the layout data of the text box to this GridData object.
>
> "Chris Laffra" <Chris_Laffra@ca.ibm.com> wrote in message
> news:cspl1d$tqv$1@www.eclipse.org...
> > Ahh. You have to tell your text to occupy 4 lines, not the enclosing
> layout.
> >
> > --
> > Chris Laffra, http://eclipsefaq.org
> >
> >
> > "Shawn L. Pecze" <pecze@us.ibm.com> wrote in message
> > news:csp2mq$mb5$1@www.eclipse.org...
> > > When the dialog is displayed, the text box only has enough room to
> display
> > > one line of text. I would like to be able to display 4 lines of text
> > before
> > > the user would have to start scrolling.
> > >
> > > "Chris Laffra" <Chris_Laffra@ca.ibm.com> wrote in message
> > > news:csmoe2$8u7$1@www.eclipse.org...
> > > > If your layout has one column, how can you tell you are not
occupying
> 4
> > > > rows?
> > > >
> > > > --
> > > > Chris Laffra, http://eclipsefaq.org
> > > >
> > > >
> > > > "Shawn L. Pecze" <pecze@us.ibm.com> wrote in message
> > > > news:csm3g7$lmj$1@www.eclipse.org...
> > > > > I want to create a textbox in a group that spans 4 rows. I have
> tried
> > > > many
> > > > > things, but I can't get the text box to be more than one row high.
> > > > >
> > > > > Here is how I'm creating the box:
> > > > >
> > > > > group = new Group(composite, SWT.NONE);
> > > > > group.setText(groupTitle);
> > > > > layout = new GridLayout();
> > > > > layout.horizontalSpacing = 15;
> > > > > layout.numColumns = 1;
> > > > > group.setLayout(layout);
> > > > > gridData = new GridData(GridData.FILL_BOTH |
> > > > > GridData.VERTICAL_ALIGN_CENTER);
> > > > > gridData.verticalSpan = 4;
> > > > > group.setLayoutData(gridData);
> > > > >
> > > > > text = new Text(group, SWT.MULTI | SWT.V_SCROLL | SWT.WRAP);
> > > > > gridData = new GridData(GridData.FILL_BOTH);
> > > > > gridData.verticalSpan = 4;
> > > > > text.setLayoutData(gridData);
> > > > >
> > > > > What am I doing wrong?
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03954 seconds