Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Getting the active cell of a table
Getting the active cell of a table [message #655521] Mon, 21 February 2011 14:45 Go to next message
David  Pérez is currently offline David PérezFriend
Messages: 228
Registered: July 2009
Senior Member
I wonder how to get the active cell of a Table.
It's easy to get the active row, but not the active column. Embarrassed
I'm not talking about the current cell editor, I'm interested about the current column, even if I'm not editing a cell.

Thanks in advance for any help.

David
Re: Getting the active cell of a table [message #656253 is a reply to message #655521] Thu, 24 February 2011 17:26 Go to previous messageGo to next message
David  Pérez is currently offline David PérezFriend
Messages: 228
Registered: July 2009
Senior Member
I think there is no API for this, and have to write low level code specific to the platform. Confused

It would be good to add this API to the next SWT release.
What do you think?
Should I open a new issue in BugZilla?

David
Re: Getting the active cell of a table [message #656354 is a reply to message #656253] Fri, 25 February 2011 09:30 Go to previous messageGo to next message
Lakshmi ShanmugamFriend
Messages: 274
Registered: July 2009
Location: India
Senior Member
Hi,

Could you describe what API you are looking for?
Using a point within the Table, we can find the TableItem and column index using the existing APIs.
For example:---
TableItem item = table.getItem (point);
for (int i=0; i<table.getColumnCount (); i++) {
Rectangle rect = item.getBounds (i);
if (rect.contains (point)) {
columnIndex = i;
}
}
Does this work for your case?


Lakshmi P Shanmugam
Re: Getting the active cell of a table [message #656366 is a reply to message #656354] Fri, 25 February 2011 09:54 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 5487
Registered: July 2009
Senior Member
JFace has introduced the concept of ViewerCell in 3.3 which uses exactly
this API.

Tom

Am 25.02.11 10:30, schrieb Lakshmi Shanmugam:
> Hi,
>
> Could you describe what API you are looking for?
> Using a point within the Table, we can find the TableItem and column
> index using the existing APIs.
> For example:---
> TableItem item = table.getItem (point);
> for (int i=0; i<table.getColumnCount (); i++) {
> Rectangle rect = item.getBounds (i);
> if (rect.contains (point)) {
> columnIndex = i;
> }
> } Does this work for your case?
>
Re: Getting the active cell of a table [message #656386 is a reply to message #656366] Fri, 25 February 2011 11:54 Go to previous messageGo to next message
David  Pérez is currently offline David PérezFriend
Messages: 228
Registered: July 2009
Senior Member
Hi Lakshmi,

I already know that API.
What I need is knowing the highlighted cell, the one where the cursor is, not the cell that lies under a given Point.

I think there is currently no way of knowing it.

Quote:
Could you describe what API you are looking for?
Using a point within the Table, we can find the TableItem and column index using the existing APIs.
Does this work for your case?
Re: Getting the active cell of a table [message #656390 is a reply to message #656386] Fri, 25 February 2011 12:07 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 5487
Registered: July 2009
Senior Member
SWT-Table has no concept of Cells because the underlying native control
doesn't have one.

If you need a grid like control to I'd suggest to use Nebula-Grid.

Tom

Am 25.02.11 12:54, schrieb David Pérez:
> Hi Lakshmi,
>
> I already know that API.
> What I need is knowing the highlighted cell, the one where the cursor
> is, not the cell that lies under a given Point.
>
> I think there is currently no way of knowing it.
>
> Quote:
>> Could you describe what API you are looking for?
>> Using a point within the Table, we can find the TableItem and column
>> index using the existing APIs.
>> Does this work for your case?
>
Previous Topic:Running a SWT app in a different OS
Next Topic:Text widget with CTRL+F search functionality
Goto Forum:
  


Current Time: Fri Dec 19 06:38:29 GMT 2014

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

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