Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » ScrolledComposite is not displaying scroll bars(While trying to create an UI for my eclipse plugin, ScrolledComposite is not showing the desired scroll bars. )
ScrolledComposite is not displaying scroll bars [message #902272] Thu, 16 August 2012 17:28 Go to next message
San Kallada is currently offline San KalladaFriend
Messages: 3
Registered: August 2012
Junior Member
Hi All,

I'm trying to create an UI for my eclipse plugin with SWT (using Eclipse Juno and Window Builder). I have table component which is added to a ScrolledComposite. This table is supposed to show about 100 rows od data. But with the code below, the ScrolledComposite is not showing up the desired scroll bars, rather the windo grows vertically.

I'm looking forward for some pointers to solve the issue( I'm very new to plug-in development).

Thanks in advance


protected Control createDialogArea(Composite parent) {
Display display = Display.getDefault();


Color yellow = display.getSystemColor(SWT.COLOR_YELLOW);
Color red = display.getSystemColor(SWT.COLOR_RED);
Color black = display.getSystemColor(SWT.COLOR_BLACK);
Color white = display.getSystemColor(SWT.COLOR_WHITE);
Color green = display.getSystemColor(SWT.COLOR_GREEN);
/* Shell*/
//Shell shell = new Shell(display);
//shell.setSize(652, 628);
//shell.setLayout(new GridLayout());


/* Error Panel*/
Composite errorPanel = new Composite(parent, SWT.NONE);
errorPanel.setBackground(red);

/* Base Panel*/
Composite basePanel = new Composite(parent, SWT.NONE);
//basePanel.
//basePanel.
basePanel.setLayout(new GridLayout(2, false));
basePanel.setBackground(yellow);

/*Table Panel*/
ScrolledComposite tablePanel = new ScrolledComposite(basePanel, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
tablePanel.setBackground(green);
tablePanel.setExpandHorizontal(true);
tablePanel.setExpandVertical(true);


table = new Table(tablePanel, SWT.BORDER | SWT.FULL_SELECTION);
table.setHeaderVisible(true);
table.setLinesVisible(true);
// table.setSize(100, 150);
tablePanel.setContent(table);
// tablePanel.setSize(100, 100);

tablePanel.setMinSize(table.computeSize(SWT.DEFAULT, SWT.DEFAULT));

/* Create table columns*/

TableColumn columnSelect = new TableColumn(table, SWT.NONE);
columnSelect.setWidth(100);
columnSelect.setText("Select");
TableColumn columnField = new TableColumn(table, SWT.NONE);
columnField.setWidth(100);
columnField.setText("Field");
TableColumn columnHTMLtype = new TableColumn(table, SWT.NONE);
columnHTMLtype.setWidth(100);
columnHTMLtype.setText("Type");

/* Generate table content*/

for (int i = 0; i < 100; i++) {
new TableItem(table, SWT.NONE);
}
TableItem[] items = table.getItems();/**/

/*
* Right button panel
*/
Composite shortCutPanel = new Composite(basePanel, SWT.NONE);
shortCutPanel.setBackground(black);

for (int i = 0; i < items.length; i++) {
TableEditor editor = new TableEditor(table);
CCombo combo = new CCombo(table, SWT.NONE);
addComboContent(combo);
editor.grabHorizontal = true;
editor.setEditor(combo, items[i], 2);
editor = new TableEditor(table);
Label lblTest = new Label(table, SWT.NONE);
lblTest.setBackground(white);
lblTest.setText("foo"+i);
editor.grabHorizontal = true;
editor.setEditor(lblTest, items[i], 1);
editor = new TableEditor(table);
Button button = new Button(table, SWT.CHECK);
button.pack();
editor.minimumWidth = button.getSize().x;
editor.horizontalAlignment = SWT.CENTER;
editor.setEditor(button, items[i], 0);
}/**/




Dialog.applyDialogFont(basePanel);


return basePanel;
}
Re: ScrolledComposite is not displaying scroll bars [message #911860 is a reply to message #902272] Wed, 12 September 2012 13:14 Go to previous messageGo to next message
Sharon Snyder is currently offline Sharon SnyderFriend
Messages: 56
Registered: September 2010
Member

If memory serves, you have to set the content before your calls setExpandHorizontal or setExpandVertical.

I usually put these 3 together after the content has been created.

Hope this helps and isn't too late to be useful.

-Sharon
Re: ScrolledComposite is not displaying scroll bars [message #922943 is a reply to message #911860] Tue, 25 September 2012 13:27 Go to previous message
San Kallada is currently offline San KalladaFriend
Messages: 3
Registered: August 2012
Junior Member
thanks Sharon
Previous Topic:Extend CEditor via a plugin
Next Topic:VariableDeclarationFragment /resolveBinding() is returning null
Goto Forum:
  


Current Time: Thu Apr 18 16:13:35 GMT 2024

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

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

Back to the top