Layout problem using CTabFolder in a form [message #447950] |
Wed, 22 December 2004 07:34 |
Eclipse User |
|
|
|
Originally posted by: tschlat.gmx.de
Hi,
i have a FormPage to display in a FormEditor. The FormPage itself contains
a CTabFolder. I would like the folder to span the whole width of the
editor. Therefore I set a layout data for the tabFolder. The problem is:
If I set the layout the width spans the editor width but the tab content
is not shown anymore (the tabs are there, only the content is missing). If
I do not set layoutData, the width of the TabFolder is "as wide as
necessary" and the content is shown.
Help would be appreciated
ciao, Thorsten
The following code creates the page content:
protected void createFormContent(IManagedForm managedForm) {
ScrolledForm form = managedForm.getForm();
FormToolkit toolkit = managedForm.getToolkit();
form.setText("Form with subpages");
form.setBackgroundImage(ClientPlugin.getDefault().
getImage(ICrmClientConstants.FORM_BANNER));
GridLayout layout = new GridLayout();
layout.marginWidth = 10;
form.getBody().setLayout(layout);
tabFolder = new CTabFolder(form.getBody(), SWT.FLAT|SWT.TOP);
toolkit.adapt(tabFolder, true, true);
// Set a layoutdata to fill horizontally
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.heightHint = 0;
tabFolder.setLayoutData(gd);
Color selectedColor = toolkit.getColors().getColor(FormColors.SEPARATOR);
tabFolder.setSelectionBackground(new Color[] {selectedColor,
toolkit.getColors().getBackground()}, new int[] {50});
tabFolder.setCursor(FormsResources.getHandCursor());
toolkit.paintBordersFor(tabFolder);
createOverviewTab(toolkit, null);
createRatingTab(toolkit, null);
tabFolder.setSelection(0);
}
private void createOverviewTab(FormToolkit toolkit, Composite parent) {
CTabItem item = new CTabItem(tabFolder, SWT.NULL);
item.setText(ClientPlugin.getDefault().
getResourceString("overviewPage.label"));
Text text = toolkit.createText(tabFolder, "Overview", SWT.SINGLE);
text.setText("Overview");
item.setControl(text);
}
private void createRatingTab(FormToolkit toolkit, Composite parent) {
CTabItem item = new CTabItem(tabFolder, SWT.NULL);
item.setText(ClientPlugin.getDefault().
getResourceString("ratingIndustryPage.
Text text = toolkit.createText(tabFolder, "Rating", SWT.SINGLE);
text.setText("Rating / Industry");
item.setControl(text);
}
|
|
|
Re: Layout problem using CTabFolder in a form [message #447992 is a reply to message #447950] |
Wed, 22 December 2004 19:17 |
Eclipse User |
|
|
|
Originally posted by: tschlat.gmx.de
Finally I found out what the problem is. If I use
GridData gd = new GridData(GridData.FILL_BOTH);
for the tabFolder it works fine.
tschlat wrote:
> Hi,
> i have a FormPage to display in a FormEditor. The FormPage itself contains
> a CTabFolder. I would like the folder to span the whole width of the
> editor. Therefore I set a layout data for the tabFolder. The problem is:
> If I set the layout the width spans the editor width but the tab content
> is not shown anymore (the tabs are there, only the content is missing). If
> I do not set layoutData, the width of the TabFolder is "as wide as
> necessary" and the content is shown.
> Help would be appreciated
> ciao, Thorsten
> The following code creates the page content:
> protected void createFormContent(IManagedForm managedForm) {
> ScrolledForm form = managedForm.getForm();
> FormToolkit toolkit = managedForm.getToolkit();
> form.setText("Form with subpages");
> form.setBackgroundImage(ClientPlugin.getDefault().
> getImage(ICrmClientConstants.FORM_BANNER));
> GridLayout layout = new GridLayout();
> layout.marginWidth = 10;
> form.getBody().setLayout(layout);
> tabFolder = new CTabFolder(form.getBody(), SWT.FLAT|SWT.TOP);
> toolkit.adapt(tabFolder, true, true);
> // Set a layoutdata to fill horizontally
> GridData gd = new GridData(GridData.FILL_HORIZONTAL);
> gd.heightHint = 0;
> tabFolder.setLayoutData(gd);
> Color selectedColor = toolkit.getColors().getColor(FormColors.SEPARATOR);
> tabFolder.setSelectionBackground(new Color[] {selectedColor,
> toolkit.getColors().getBackground()}, new int[] {50});
> tabFolder.setCursor(FormsResources.getHandCursor());
> toolkit.paintBordersFor(tabFolder);
> createOverviewTab(toolkit, null);
> createRatingTab(toolkit, null);
> tabFolder.setSelection(0);
> }
> private void createOverviewTab(FormToolkit toolkit, Composite parent) {
> CTabItem item = new CTabItem(tabFolder, SWT.NULL);
> item.setText(ClientPlugin.getDefault().
> getResourceString("overviewPage.label"));
> Text text = toolkit.createText(tabFolder, "Overview", SWT.SINGLE);
> text.setText("Overview");
> item.setControl(text);
> }
> private void createRatingTab(FormToolkit toolkit, Composite parent) {
> CTabItem item = new CTabItem(tabFolder, SWT.NULL);
> item.setText(ClientPlugin.getDefault().
> getResourceString("ratingIndustryPage.
> Text text = toolkit.createText(tabFolder, "Rating", SWT.SINGLE);
> text.setText("Rating / Industry");
> item.setControl(text);
> }
|
|
|
Powered by
FUDForum. Page generated in 0.03397 seconds