Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » [SWT] Strange problem with layouts and CTabFolder
[SWT] Strange problem with layouts and CTabFolder [message #236868] Sat, 06 October 2007 17:55
Eclipse User
Originally posted by: swierczu.dmcs.pl

I am new in SWT and I have a strange problem which I can not solve myself.
I'm working with CTabFolder:
[...]
final Shell shell = new Shell(display);
shell.setSize(640, 480);
FillLayout layout = new FillLayout();
layout.type = SWT.VERTICAL;
layout.marginHeight = 10;
shell.setLayout(layout);
[...]
CTabFolder folder = new CTabFolder(shell, SWT.BORDER);
[...]
final CTabItem tab = new CTabItem(folder, SWT.CLOSE);
tab.setText("New questions wizard");
this.setSelection(tab);

Group desk = new Group(folder, SWT.NONE);
desk.setText("*test*");
tab.setControl(desk);

GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 3;

desk.setLayout(gridLayout);
GridData gridData = new GridData();

new Label(desk, SWT.NULL).setText("Project name: ");
final Text name = new Text(desk, SWT.BORDER | SWT.SINGLE);
gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gridData.horizontalSpan = 2;
name.setLayoutData(gridData);
name.forceFocus();

Label info = new Label(desk, SWT.NULL);
info.setText("Project description:");
gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gridData.horizontalSpan = 3;
info.setLayoutData(gridData);

Text text = new Text(desk, SWT.BORDER | SWT.MULTI);
gridData = new GridData();
gridData.horizontalAlignment = GridData.FILL;
gridData.verticalAlignment = GridData.FILL;
gridData.horizontalSpan = 3;
gridData.grabExcessHorizontalSpace = true;
gridData.grabExcessVerticalSpace = true;
text.setLayoutData(gridData);
[...]
When I run application I see window (shell), tab (CTabFolder), desk
(Group) with '*test*' title but I don't see anything inside desk (labels
and texts). When I resize window everything appears and looks as I want!
What is wrong with this code that I have to resize window to see all
widgets?

Best regards,
Bartlomiej.
Previous Topic:unable to create simple EJB
Next Topic:MinGW libraries
Goto Forum:
  


Current Time: Mon Oct 20 13:03:46 GMT 2014

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

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