Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » Multiple selection of items in nebula grid
Multiple selection of items in nebula grid [message #17174] Mon, 27 November 2006 11:11 Go to next message
Eclipse User
Originally posted by: krishna.24jan.gmail.com

Hi,

Can any one suggest possible solutions to enable multiple select of
grid items in nebula grid.when i drag my mouse over the items the focus
comes over the items but only one item gets selected at a time.I want is
to select multiple items when i drag my mouse over them.

Can any one kindly suggest possible solutions for making it happen.

Thanks in advance
krishna
Re: Multiple selection of items in nebula grid [message #17848 is a reply to message #17174] Mon, 27 November 2006 11:27 Go to previous messageGo to next message
Chris Gross is currently offline Chris Gross
Messages: 253
Registered: July 2009
Senior Member
Do you want cell selection like a spreadsheet? If so, just use
setCellSelectionEnabled(true).

Otherwise, you can code your own mouse listeners and set the selection
of the grid however you want.

Regards,
-Chris

krishna wrote:
> Hi,
>
> Can any one suggest possible solutions to enable multiple select of
> grid items in nebula grid.when i drag my mouse over the items the focus
> comes over the items but only one item gets selected at a time.I want is
> to select multiple items when i drag my mouse over them.
>
> Can any one kindly suggest possible solutions for making it happen.
>
> Thanks in advance
> krishna
>
Re: Multiple selection of items in nebula grid [message #17882 is a reply to message #17848] Tue, 28 November 2006 00:09 Go to previous messageGo to next message
Eclipse User
Originally posted by: krishna_24jan.gmail.com

Hi chris,

with set cell selection enabled as true u can select cells individually.

All i want is ,when i drag my mouse over some cells all the cells must be
selected.
Currently what is happening is when i drag my mouse over the items only
the first item gets selected rest all the items just come in to focus.

suppose i select a cell and drag my mouse over 5 cells the getselectedcell
count returns only one.
My reqmt is to select multiple cells at a time and perform a single
operation on it by right clicking on it.

Please help me out in this..


Thanks in advance
krishna
Re: Multiple selection of items in nebula grid [message #17907 is a reply to message #17882] Tue, 28 November 2006 10:41 Go to previous messageGo to next message
Chris Gross is currently offline Chris Gross
Messages: 253
Registered: July 2009
Senior Member
Cell selection is designed to allow for drag select. It works for me.

Can you send a code snippet that shows how you are creating the Grid?

-Chris

krishna wrote:
> Hi chris,
>
> with set cell selection enabled as true u can select cells individually.
>
> All i want is ,when i drag my mouse over some cells all the cells must
> be selected.
> Currently what is happening is when i drag my mouse over the items only
> the first item gets selected rest all the items just come in to focus.
>
> suppose i select a cell and drag my mouse over 5 cells the
> getselectedcell count returns only one.
> My reqmt is to select multiple cells at a time and perform a single
> operation on it by right clicking on it.
>
> Please help me out in this..
>
>
> Thanks in advance
> krishna
>
Re: Multiple selection of items in nebula grid [message #17988 is a reply to message #17907] Tue, 28 November 2006 22:36 Go to previous messageGo to next message
Eclipse User
Originally posted by: krishna_24jan.gmail.com

The code for creating grid ::

final Grid grid =new Grid(shell,SWT.BORDER | SWT.V_SCROLL |
SWT.H_SCROLL|SWT.MULTI);

grid.setHeaderVisible(true);
grid.setRowHeaderVisible(true);
grid.setLinesVisible(false);
grid.setCellSelectionEnabled(true);
For this grid iam adding column headers and row headers too.

Now Iam adding grditems for this grid and want multiple selection of items
when i drag my mouse over them..
Re: Multiple selection of items in nebula grid [message #18014 is a reply to message #17988] Wed, 29 November 2006 09:52 Go to previous messageGo to next message
Chris Gross is currently offline Chris Gross
Messages: 253
Registered: July 2009
Senior Member
I can't reproduce your problem. Using the same code below I can drag my
mouse and select multiple cells. Do you have any other special code
that could be changing the selection? What OS are you using?

krishna wrote:
> The code for creating grid ::
>
> final Grid grid =new Grid(shell,SWT.BORDER | SWT.V_SCROLL |
> SWT.H_SCROLL|SWT.MULTI);
>
> grid.setHeaderVisible(true);
> grid.setRowHeaderVisible(true);
> grid.setLinesVisible(false);
> grid.setCellSelectionEnabled(true);
> For this grid iam adding column headers and row headers too.
>
> Now Iam adding grditems for this grid and want multiple selection of
> items when i drag my mouse over them..
>
>
>
Re: Multiple selection of items in nebula grid [message #18027 is a reply to message #17988] Wed, 29 November 2006 09:55 Go to previous messageGo to next message
Chris Gross is currently offline Chris Gross
Messages: 253
Registered: July 2009
Senior Member
Are you creating editors on top of the Grid? The editors will consume
the mouse events required for the drag select. The Grid cell selection
is not designed to be used in combination with editors that stay visible
for the entire lifetime of the Grid.

krishna wrote:
> The code for creating grid ::
>
> final Grid grid =new Grid(shell,SWT.BORDER | SWT.V_SCROLL |
> SWT.H_SCROLL|SWT.MULTI);
>
> grid.setHeaderVisible(true);
> grid.setRowHeaderVisible(true);
> grid.setLinesVisible(false);
> grid.setCellSelectionEnabled(true);
> For this grid iam adding column headers and row headers too.
>
> Now Iam adding grditems for this grid and want multiple selection of
> items when i drag my mouse over them..
>
>
>
Re: Multiple selection of items in nebula grid [message #18054 is a reply to message #18014] Wed, 29 November 2006 23:11 Go to previous messageGo to next message
Eclipse User
Originally posted by: krishna_24jan.gmail.com

Iam using windows operating system.

addition to that code of creating grid ,i have some code for creating grid
items
and i just added one mouse listener.

grid.addMouseListener(new MouseAdapter(){
public void mouseDown(MouseEvent e){
if(e.button==1){

if(grid.getCellSelectionCount()!=0){

Point pt = grid.getCellSelection()[0];
System.out.println(+pt.x + "***");
System.out.println(pt + "&&&" + grid.getColumn(pt));
System.out.println("Well ID is -- "
+ well[pt.x][pt.y].getWellId());

the cell selection count is getting one every time when ever i drag my
mouse over the items.

are u sure ur getting cellselection count more than one every time
cause items are only coming in to focus but not getting selected.
Re: Multiple selection of items in nebula grid [message #18063 is a reply to message #18027] Wed, 29 November 2006 23:29 Go to previous messageGo to next message
Eclipse User
Originally posted by: krishna_24jan.gmail.com

nop!Iam not using any type of editors on top of the grid..!
Re: Multiple selection of items in nebula grid [message #18645 is a reply to message #18054] Thu, 30 November 2006 10:51 Go to previous messageGo to next message
Chris Gross is currently offline Chris Gross
Messages: 253
Registered: July 2009
Senior Member
Your code below is only asking for the selection count when a user
initially clicks the left mouse button... which is when the old
selection is cleared and a new drag selection is started. Thus there is
only ever one cell selected when a user clicks the left mouse button
(except when using CTRL or SHIFT). Listen to the selection event if you
want to get a callback every time the selection is updated. Read the
javadoc on addSelectionListener for more detail.

krishna wrote:
> Iam using windows operating system.
>
> addition to that code of creating grid ,i have some code for creating
> grid items
> and i just added one mouse listener.
>
> grid.addMouseListener(new MouseAdapter(){
> public void mouseDown(MouseEvent e){
> if(e.button==1){
> if(grid.getCellSelectionCount()!=0){
> Point pt =
> grid.getCellSelection()[0];
> System.out.println(+pt.x + "***");
> System.out.println(pt + "&&&" + grid.getColumn(pt));
> System.out.println("Well ID is -- "
> + well[pt.x][pt.y].getWellId());
>
> the cell selection count is getting one every time when ever i drag my
> mouse over the items.
>
> are u sure ur getting cellselection count more than one every time
> cause items are only coming in to focus but not getting selected.
>
Re: Multiple selection of items in nebula grid [message #18850 is a reply to message #18645] Fri, 01 December 2006 02:15 Go to previous messageGo to next message
Eclipse User
Originally posted by: krishna_24jan.gmail.com

My requirement is i need to select multiple cells in a drag and when i
right click on them i need to perform some action on them.

As u have suggested can u send me a sample snippet abt how handle the
selection listener as per my requirement..
Re: Multiple selection of items in nebula grid [message #18895 is a reply to message #18850] Fri, 01 December 2006 09:19 Go to previous messageGo to next message
Chris Gross is currently offline Chris Gross
Messages: 253
Registered: July 2009
Senior Member
Change "e.button == 1" to "e.button == 3" .... ?

krishna wrote:
> My requirement is i need to select multiple cells in a drag and when i
> right click on them i need to perform some action on them.
>
> As u have suggested can u send me a sample snippet abt how handle the
> selection listener as per my requirement..
>
>
>
>
>
>
Re: Multiple selection of items in nebula grid [message #19305 is a reply to message #18895] Mon, 04 December 2006 00:20 Go to previous message
Eclipse User
Originally posted by: krishna_24jan.gmail.com

Thanks Chris..!

Its working now..
Re: Multiple selection of items in nebula grid [message #569299 is a reply to message #17174] Mon, 27 November 2006 11:27 Go to previous message
Chris Gross is currently offline Chris Gross
Messages: 471
Registered: July 2009
Senior Member
Do you want cell selection like a spreadsheet? If so, just use
setCellSelectionEnabled(true).

Otherwise, you can code your own mouse listeners and set the selection
of the grid however you want.

Regards,
-Chris

krishna wrote:
> Hi,
>
> Can any one suggest possible solutions to enable multiple select of
> grid items in nebula grid.when i drag my mouse over the items the focus
> comes over the items but only one item gets selected at a time.I want is
> to select multiple items when i drag my mouse over them.
>
> Can any one kindly suggest possible solutions for making it happen.
>
> Thanks in advance
> krishna
>
Re: Multiple selection of items in nebula grid [message #569438 is a reply to message #17848] Tue, 28 November 2006 00:09 Go to previous message
krishna is currently offline krishna
Messages: 48
Registered: July 2009
Member
Hi chris,

with set cell selection enabled as true u can select cells individually.

All i want is ,when i drag my mouse over some cells all the cells must be
selected.
Currently what is happening is when i drag my mouse over the items only
the first item gets selected rest all the items just come in to focus.

suppose i select a cell and drag my mouse over 5 cells the getselectedcell
count returns only one.
My reqmt is to select multiple cells at a time and perform a single
operation on it by right clicking on it.

Please help me out in this..


Thanks in advance
krishna
Re: Multiple selection of items in nebula grid [message #569526 is a reply to message #17882] Tue, 28 November 2006 10:41 Go to previous message
Chris Gross is currently offline Chris Gross
Messages: 471
Registered: July 2009
Senior Member
Cell selection is designed to allow for drag select. It works for me.

Can you send a code snippet that shows how you are creating the Grid?

-Chris

krishna wrote:
> Hi chris,
>
> with set cell selection enabled as true u can select cells individually.
>
> All i want is ,when i drag my mouse over some cells all the cells must
> be selected.
> Currently what is happening is when i drag my mouse over the items only
> the first item gets selected rest all the items just come in to focus.
>
> suppose i select a cell and drag my mouse over 5 cells the
> getselectedcell count returns only one.
> My reqmt is to select multiple cells at a time and perform a single
> operation on it by right clicking on it.
>
> Please help me out in this..
>
>
> Thanks in advance
> krishna
>
Re: Multiple selection of items in nebula grid [message #569756 is a reply to message #17907] Tue, 28 November 2006 22:36 Go to previous message
krishna is currently offline krishna
Messages: 48
Registered: July 2009
Member
The code for creating grid ::

final Grid grid =new Grid(shell,SWT.BORDER | SWT.V_SCROLL |
SWT.H_SCROLL|SWT.MULTI);

grid.setHeaderVisible(true);
grid.setRowHeaderVisible(true);
grid.setLinesVisible(false);
grid.setCellSelectionEnabled(true);
For this grid iam adding column headers and row headers too.

Now Iam adding grditems for this grid and want multiple selection of items
when i drag my mouse over them..
Re: Multiple selection of items in nebula grid [message #569821 is a reply to message #17988] Wed, 29 November 2006 09:52 Go to previous message
Chris Gross is currently offline Chris Gross
Messages: 471
Registered: July 2009
Senior Member
I can't reproduce your problem. Using the same code below I can drag my
mouse and select multiple cells. Do you have any other special code
that could be changing the selection? What OS are you using?

krishna wrote:
> The code for creating grid ::
>
> final Grid grid =new Grid(shell,SWT.BORDER | SWT.V_SCROLL |
> SWT.H_SCROLL|SWT.MULTI);
>
> grid.setHeaderVisible(true);
> grid.setRowHeaderVisible(true);
> grid.setLinesVisible(false);
> grid.setCellSelectionEnabled(true);
> For this grid iam adding column headers and row headers too.
>
> Now Iam adding grditems for this grid and want multiple selection of
> items when i drag my mouse over them..
>
>
>
Re: Multiple selection of items in nebula grid [message #569856 is a reply to message #17988] Wed, 29 November 2006 09:55 Go to previous message
Chris Gross is currently offline Chris Gross
Messages: 471
Registered: July 2009
Senior Member
Are you creating editors on top of the Grid? The editors will consume
the mouse events required for the drag select. The Grid cell selection
is not designed to be used in combination with editors that stay visible
for the entire lifetime of the Grid.

krishna wrote:
> The code for creating grid ::
>
> final Grid grid =new Grid(shell,SWT.BORDER | SWT.V_SCROLL |
> SWT.H_SCROLL|SWT.MULTI);
>
> grid.setHeaderVisible(true);
> grid.setRowHeaderVisible(true);
> grid.setLinesVisible(false);
> grid.setCellSelectionEnabled(true);
> For this grid iam adding column headers and row headers too.
>
> Now Iam adding grditems for this grid and want multiple selection of
> items when i drag my mouse over them..
>
>
>
Re: Multiple selection of items in nebula grid [message #569922 is a reply to message #18014] Wed, 29 November 2006 23:11 Go to previous message
krishna is currently offline krishna
Messages: 48
Registered: July 2009
Member
Iam using windows operating system.

addition to that code of creating grid ,i have some code for creating grid
items
and i just added one mouse listener.

grid.addMouseListener(new MouseAdapter(){
public void mouseDown(MouseEvent e){
if(e.button==1){

if(grid.getCellSelectionCount()!=0){

Point pt = grid.getCellSelection()[0];
System.out.println(+pt.x + "***");
System.out.println(pt + "&&&" + grid.getColumn(pt));
System.out.println("Well ID is -- "
+ well[pt.x][pt.y].getWellId());

the cell selection count is getting one every time when ever i drag my
mouse over the items.

are u sure ur getting cellselection count more than one every time
cause items are only coming in to focus but not getting selected.
Re: Multiple selection of items in nebula grid [message #569966 is a reply to message #18027] Wed, 29 November 2006 23:29 Go to previous message
krishna is currently offline krishna
Messages: 48
Registered: July 2009
Member
nop!Iam not using any type of editors on top of the grid..!
Re: Multiple selection of items in nebula grid [message #570161 is a reply to message #18054] Thu, 30 November 2006 10:51 Go to previous message
Chris Gross is currently offline Chris Gross
Messages: 471
Registered: July 2009
Senior Member
Your code below is only asking for the selection count when a user
initially clicks the left mouse button... which is when the old
selection is cleared and a new drag selection is started. Thus there is
only ever one cell selected when a user clicks the left mouse button
(except when using CTRL or SHIFT). Listen to the selection event if you
want to get a callback every time the selection is updated. Read the
javadoc on addSelectionListener for more detail.

krishna wrote:
> Iam using windows operating system.
>
> addition to that code of creating grid ,i have some code for creating
> grid items
> and i just added one mouse listener.
>
> grid.addMouseListener(new MouseAdapter(){
> public void mouseDown(MouseEvent e){
> if(e.button==1){
> if(grid.getCellSelectionCount()!=0){
> Point pt =
> grid.getCellSelection()[0];
> System.out.println(+pt.x + "***");
> System.out.println(pt + "&&&" + grid.getColumn(pt));
> System.out.println("Well ID is -- "
> + well[pt.x][pt.y].getWellId());
>
> the cell selection count is getting one every time when ever i drag my
> mouse over the items.
>
> are u sure ur getting cellselection count more than one every time
> cause items are only coming in to focus but not getting selected.
>
Re: Multiple selection of items in nebula grid [message #570661 is a reply to message #18645] Fri, 01 December 2006 02:15 Go to previous message
krishna is currently offline krishna
Messages: 48
Registered: July 2009
Member
My requirement is i need to select multiple cells in a drag and when i
right click on them i need to perform some action on them.

As u have suggested can u send me a sample snippet abt how handle the
selection listener as per my requirement..
Re: Multiple selection of items in nebula grid [message #570730 is a reply to message #18850] Fri, 01 December 2006 09:19 Go to previous message
Chris Gross is currently offline Chris Gross
Messages: 471
Registered: July 2009
Senior Member
Change "e.button == 1" to "e.button == 3" .... ?

krishna wrote:
> My requirement is i need to select multiple cells in a drag and when i
> right click on them i need to perform some action on them.
>
> As u have suggested can u send me a sample snippet abt how handle the
> selection listener as per my requirement..
>
>
>
>
>
>
Re: Multiple selection of items in nebula grid [message #571213 is a reply to message #18895] Mon, 04 December 2006 00:20 Go to previous message
krishna is currently offline krishna
Messages: 48
Registered: July 2009
Member
Thanks Chris..!

Its working now..
Previous Topic:Grid - DefaultCellRenderer
Next Topic:Grid item resize
Goto Forum:
  


Current Time: Fri Jul 25 03:06:28 EDT 2014

Powered by FUDForum. Page generated in 0.04870 seconds