Skip to main content


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 16:11 Go to next message
Eclipse UserFriend
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 16:27 Go to previous messageGo to next message
Chris Gross is currently offline Chris GrossFriend
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 05:09 Go to previous messageGo to next message
Eclipse UserFriend
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 15:41 Go to previous messageGo to next message
Chris Gross is currently offline Chris GrossFriend
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] Wed, 29 November 2006 03:36 Go to previous messageGo to next message
Eclipse UserFriend
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 14:52 Go to previous messageGo to next message
Chris Gross is currently offline Chris GrossFriend
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 14:55 Go to previous messageGo to next message
Chris Gross is currently offline Chris GrossFriend
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] Thu, 30 November 2006 04:11 Go to previous messageGo to next message
Eclipse UserFriend
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] Thu, 30 November 2006 04:29 Go to previous messageGo to next message
Eclipse UserFriend
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 15:51 Go to previous messageGo to next message
Chris Gross is currently offline Chris GrossFriend
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 07:15 Go to previous messageGo to next message
Eclipse UserFriend
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 14:19 Go to previous messageGo to next message
Chris Gross is currently offline Chris GrossFriend
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 05:20 Go to previous messageGo to next message
Eclipse UserFriend
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 16:27 Go to previous messageGo to next message
Chris Gross is currently offline Chris GrossFriend
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 05:09 Go to previous messageGo to next message
krishna is currently offline krishnaFriend
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 15:41 Go to previous messageGo to next message
Chris Gross is currently offline Chris GrossFriend
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] Wed, 29 November 2006 03:36 Go to previous messageGo to next message
krishna is currently offline krishnaFriend
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 14:52 Go to previous messageGo to next message
Chris Gross is currently offline Chris GrossFriend
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 14:55 Go to previous messageGo to next message
Chris Gross is currently offline Chris GrossFriend
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] Thu, 30 November 2006 04:11 Go to previous messageGo to next message
krishna is currently offline krishnaFriend
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] Thu, 30 November 2006 04:29 Go to previous messageGo to next message
krishna is currently offline krishnaFriend
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 15:51 Go to previous messageGo to next message
Chris Gross is currently offline Chris GrossFriend
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 07:15 Go to previous messageGo to next message
krishna is currently offline krishnaFriend
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 14:19 Go to previous messageGo to next message
Chris Gross is currently offline Chris GrossFriend
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 05:20 Go to previous messageGo to next message
krishna is currently offline krishnaFriend
Messages: 48
Registered: July 2009
Member
Thanks Chris..!

Its working now..
Re: Multiple selection of items in nebula grid [message #1719227 is a reply to message #19305] Wed, 06 January 2016 11:15 Go to previous message
Harshini Garikiparthi is currently offline Harshini GarikiparthiFriend
Messages: 23
Registered: March 2015
Junior Member
Hello , I am working on Nebula Grid something related to the above problem.
I have a grid , I select a cell-1 , Drag it down and on mouse release i have to copy down the text selected from cell-1 to all the cells dragged down.
I did a mouselistner

grid.addMouseListener(new MouseAdapter()
{
public void mouseDown(MouseEvent e) {
ViewerCell viewerCell = grid.getCell(new Point(e.x,e.y));
String cellText = viewerCell.getText();
System.out.println("Cell clicked: " + cellText);
}

Here I am able to get the text of selected cell , How do i add drag action to the mouse listner
I have tried to use
- mouseReleased(MouseEvent e)
-mouseDragged(MouseEvent e)
but it seems it doesnt work with Nebula grid
Please suggest a way.
Previous Topic:Drag on Copy an Excel like feature inside Nebula Grid
Next Topic:Nebula grid Mouse Drag Listner
Goto Forum:
  


Current Time: Tue Apr 16 06:02:50 GMT 2024

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

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

Back to the top