Skip to main content



      Home
Home » Eclipse Projects » Nebula » Grid bug under windows
Grid bug under windows [message #43024] Fri, 09 November 2007 12:12 Go to next message
Eclipse UserFriend
Originally posted by: svo.ciklum.net

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
Re: Grid bug under windows [message #43265 is a reply to message #43024] Mon, 12 November 2007 11:15 Go to previous message
Eclipse UserFriend
Hi Stanislav,

Its a bug. The combo is capturing mouse events. The mousedown on the
grid is being sent to the combo to tell it to close the dropdown.
Subsequently the combo stops capturing mouse events and the grid gets
the related mouse up. The cell selection logic should really have been
written to capture the mouse as well and then would have avoided this
problem. But theres a much simpler fix that I added without doing that.
I've committed that fix. The Nebula build is currently not executing
and I am working to fix that. Once that is fixed, please download a new
build.

Regards,
-Chris

Stanislav Vodetskyi wrote:
> 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
Re: Grid bug under windows [message #586352 is a reply to message #43024] Mon, 12 November 2007 11:15 Go to previous message
Eclipse UserFriend
Hi Stanislav,

Its a bug. The combo is capturing mouse events. The mousedown on the
grid is being sent to the combo to tell it to close the dropdown.
Subsequently the combo stops capturing mouse events and the grid gets
the related mouse up. The cell selection logic should really have been
written to capture the mouse as well and then would have avoided this
problem. But theres a much simpler fix that I added without doing that.
I've committed that fix. The Nebula build is currently not executing
and I am working to fix that. Once that is fixed, please download a new
build.

Regards,
-Chris

Stanislav Vodetskyi wrote:
> 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:Displaying a message in grid view when no rows are created
Next Topic:Inserting an item in Grid at specified position
Goto Forum:
  


Current Time: Wed Jul 16 16:34:41 EDT 2025

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

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

Back to the top