Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » TableHeader listener
TableHeader listener [message #454320] Wed, 20 April 2005 11:39 Go to next message
Eclipse UserFriend
Originally posted by: elbucho.gmx.de

Is it possible to add a listener to the header of column of a table ? I'm
trying to implement a sort mechanism, that the user can click on the column
header to change form ascending sorting to descending sorting or vice versa.
Is something like this possible ?
Re: TableHeader listener [message #454328 is a reply to message #454320] Wed, 20 April 2005 13:51 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
Use TableColumn.addSelectionListener(...).

"Roland J
Re: TableHeader listener [message #454329 is a reply to message #454320] Wed, 20 April 2005 14:50 Go to previous messageGo to next message
Chad is currently offline ChadFriend
Messages: 7
Registered: July 2009
Junior Member
Roland

You can add a selection listener to the table column.

TableColumn[] columns = getColumns();
int i=0;
for (TableColumn column: columns){
if (i == 0) {
i++;
continue;
}
column.addSelectionListener(new SelectionAdapter() ...);
i++;
}

Good Luck
Chad


"Roland J
Re: TableHeader listener [message #454457 is a reply to message #454329] Thu, 21 April 2005 09:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: elbucho.gmx.de

Thanks to both of you. That was it !


"Chad" <cgustafson@chessys.com> wrote in message
news:d45qbj$8r0$1@news.eclipse.org...
>
> Roland
>
> You can add a selection listener to the table column.
>
> TableColumn[] columns = getColumns();
> int i=0;
> for (TableColumn column: columns){
> if (i == 0) {
> i++;
> continue;
> }
> column.addSelectionListener(new SelectionAdapter() ...);
> i++;
> }
>
> Good Luck
> Chad
>
>
> "Roland J
Re: TableHeader listener [message #454459 is a reply to message #454457] Thu, 21 April 2005 09:51 Go to previous message
Eclipse UserFriend
Originally posted by: elbucho.gmx.de

And while searching for some hint to sort a table, I found the following. It
may help others who want to do the same:

http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet2.java?rev=HEAD


"Roland J
Previous Topic:Where can I get the org.eclipse.swt.custom controls?
Next Topic:how to force a paint event?
Goto Forum:
  


Current Time: Thu Mar 04 10:52:11 GMT 2021

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

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

Back to the top