[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.swt] SWT Table
|
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