Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How to select only one cell in a Table
How to select only one cell in a Table [message #463348] Fri, 04 November 2005 05:02 Go to next message
Eclipse User
Originally posted by: siegfried.heintze.com

I'm using a table and when I click on it with the mouse, the whole row is
hi-lighted. How do I change this behavior?

Also, I added a selection listener and, not surprisingly,
table.getSelection()[0].getText() gives me the first element in the row and
I want the second element in the row. How do I get the second element of the
row? I tried, table.getSelection()[1].getText() but this just caused it to
crashed.

Thanks,
Siegfried
Re: How to select only one cell in a Table [message #463428 is a reply to message #463348] Sun, 06 November 2005 01:03 Go to previous messageGo to next message
Eclipse User
Originally posted by: friederich.kupzog.de

I am not much in SWT table but I think there was something like
setRowSelection or it is the SWT.FULL_SELECTION style that determines
whether the full row or a single cell is selected.


Siegfried Heintze wrote:
> I'm using a table and when I click on it with the mouse, the whole row is
> hi-lighted. How do I change this behavior?
>
> Also, I added a selection listener and, not surprisingly,
> table.getSelection()[0].getText() gives me the first element in the row and
> I want the second element in the row. How do I get the second element of the
> row? I tried, table.getSelection()[1].getText() but this just caused it to
> crashed.
>
> Thanks,
> Siegfried
>
>


--
Friederich Kupzog
Elektronik & Software
Neusser Str. 5-7
50670 Köln
Tel 0241 160696-1
Fax 0221 726670
www.kupzog.de/fkmk
Re: How to select only one cell in a Table [message #463464 is a reply to message #463348] Mon, 07 November 2005 15:44 Go to previous message
Veronika Irvine is currently offline Veronika Irvine
Messages: 1272
Registered: July 2009
Senior Member
Native tables only support selecting the first cell in a row or the entire
row.
To select individual cells, you need to use something like TableCursor.

See the following snippet:

http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet96.java?rev=HEAD&a mp;content-type=text/vnd.viewcvs-markup

"Siegfried Heintze" <siegfried@heintze.com> wrote in message
news:dkeq0a$d5s$1@news.eclipse.org...
> I'm using a table and when I click on it with the mouse, the whole row is
> hi-lighted. How do I change this behavior?
>
> Also, I added a selection listener and, not surprisingly,
> table.getSelection()[0].getText() gives me the first element in the row
> and
> I want the second element in the row. How do I get the second element of
> the
> row? I tried, table.getSelection()[1].getText() but this just caused it to
> crashed.
>
> Thanks,
> Siegfried
>
>
Previous Topic:Question about the Widget#showMenu function?
Next Topic:CTabItem not focusing as expected
Goto Forum:
  


Current Time: Sat Oct 25 07:49:31 GMT 2014

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

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