[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: SWT Table

you need to use the style SWT.FULL_SELECTION the get the whole row
selected. If you want a single cell colored you need to much more code
but JFace will probably provide the feature you are searching for [1] by
providing CellSelections and coloring features for them.

[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=151295

If you want to see this in M5 which is the last chance vote for it.

Tom

Swetha schrieb:
> Hi,
> 
>   I am using table to represent the list of items in rows and columns,
> 
> In a Mouse listener, how can I get the item that is clicked on 2nd row
> and 5th column....
> 
> Table declaration is------
> 
> Table table = new Table(sash_form, SWT.BORDER | SWT.V_SCROLL |
> SWT.H_SCROLL | SWT.SINGLE);
> 
> 
> I am using the following code in Mouse listener
> 
>     Point h = new Point(r.x, r.y); // r is the MouseEvent
>    TableItem tableItem=table.getItem(h);
>    String clickedItem = "";
> 
>    int column = -1;
>    for (int i = 0, n = table.getColumnCount(); i < n; i++) {
>      Rectangle rect = tableItem.getBounds(i);
>      if (rect.contains(h)) {
>        // This is the selected column
>        column = i;
>        break;
>      }
>    }
>      clickedItem = table.getItem(h).getText(column);
>   System.out.println("item isss  = "+clickedItem );
> 
> 
> only the column contents are being selected .... all other column
> contenets are not being selected....
> 
> Please help me in getting this resolved...
> 
> Thanks,
> Swetha
> 
> 
> 
> 
> 
> 
> 
> 
>