Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » Grid bug under windows
Grid bug under windows [message #586258] Fri, 09 November 2007 17:12
blutkind  is currently offline blutkind Friend
Messages: 25
Registered: July 2009
Junior Member
Hi,

We've discovered strange behaviour of grid on windows, when it's placed
into the shell, that also contains combo. Just run the snippet that
follows and perform these steps:
How to see the bug:
1)Click in the first cell in the grid.
2)Click the combo box once, drop-down list is closed
3)Click the last cell in the grid
4)All grid is selected
As far as we understood, combo's dropdown list behaves like a modal
dialog, and, moreover, when you perform step 3 the grid receives only
MouseUp event - maybe that's the issue. Strangely, but this doesn't
appear under MacOS X.
Are we doing something wrong, or is it a bug? I've decided to ask here
first, before posting bug report.

*********** the snippet******************
package org.eclipse.swt.nebula.snippets.grid;


import org.eclipse.nebula.widgets.grid.Grid;
import org.eclipse.nebula.widgets.grid.GridColumn;
import org.eclipse.nebula.widgets.grid.GridItem;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

/**
* @author svo
*
*/
public class GridBugSnippet {

/**
* @param args
*/
public static void main (String [] args) {
Display display = new Display ();
Shell shell = new Shell (display);
shell.setLayout(new FillLayout());
shell.setSize(800, 600);
Composite composite = new Composite(shell, SWT.NONE);
composite.setLayout(new RowLayout());
Combo combo = new Combo(composite, SWT.READ_ONLY);
combo.setItems(new String[] {"test1", "test2", "test3"});
combo.select(0);
Text text = new Text(composite, SWT.MULTI | SWT.READ_ONLY);
text.setText("How to see the bug:\n" +
"1)Click in the first cell in the grid.\n" +
"2)Click the combo box once, drop-down list is closed\n" +
"3)Click the last cell in the grid\n" +
"4)All grid is selected");
Grid grid = new Grid(shell,SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
grid.setHeaderVisible(true);
grid.setCellSelectionEnabled(true);
GridColumn column = new GridColumn(grid,SWT.NONE);
column.setText("Column 1");
column.setWidth(100);
GridColumn column2 = new GridColumn(grid,SWT.NONE);
column2.setText("Column 2");
column2.setWidth(100);
GridItem item1 = new GridItem(grid,SWT.NONE);
item1.setText("First Item");
item1.setText(1,"xxxxxxx");
GridItem item2 = new GridItem(grid,SWT.NONE);
item2.setText("This cell spans both columns");
item1.setText(1,"xxxxxxx");
item2.setColumnSpan(0,1);
GridItem item3 = new GridItem(grid,SWT.NONE);
item3.setText("Third Item");
item1.setText(1,"xxxxxxx");

shell.setSize(200,200);
shell.open ();
shell.pack();
while (!shell.isDisposed()) {
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
}
}
***********************

PS I used the snippet from eclipse.org as a basis.

Regards,
Stanislav
Previous Topic:Rich text (HTML) editor
Next Topic:Displaying a message in grid view when no rows are created
Goto Forum:
  


Current Time: Sat Nov 29 07:50:11 GMT 2014

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

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