Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Table selection event
Table selection event [message #466658] Thu, 12 January 2006 13:43 Go to next message
Henry is currently offline HenryFriend
Messages: 4
Registered: July 2009
Junior Member
Hi,

I have a Table, with three TableColumn's, the first is a name, and the last
is a buttom, the center is a regular cell.
Whenever a row gets selected the middle row changes to a widget depending on
the value in the first row.
So, I have a selectionListener on the table which creates a TableEditor and
specific widget and populates it.
My problem is that I wish the user to be able to use Tab and/or the down
arrow, to cycle through the rows in the table.
Soon I realised that using table.select() and table.setSelection() don't
send SelectionEvents, but I am wondering how if there is already a
workaround or an easier way than say, sending my own type of event?

Any help is welcome.

Thank you
Henry
Re: Table selection event [message #466660 is a reply to message #466658] Thu, 12 January 2006 14:33 Go to previous messageGo to next message
Henry is currently offline HenryFriend
Messages: 4
Registered: July 2009
Junior Member
Here is what I have decided to use for the time being.

parentTable.addTraverseListener( new TraverseListener() {
public void keyTraversed(TraverseEvent e) {
switch(e.detail) {
case SWT.TRAVERSE_TAB_NEXT:
{
Event eV = new Event();
eV.type = SWT.KeyDown;
eV.keyCode = SWT.ARROW_DOWN;
parentTable.getDisplay().post(eV);
}
break;
case SWT.TRAVERSE_TAB_PREVIOUS:
{
Event eV = new Event();
eV.type = SWT.KeyDown;
eV.keyCode = SWT.ARROW_UP;
parentTable.getDisplay().post(eV);
}
break;
}
e.doit = false;
}
});

Also, each of the widgets taht gets created has a similar TraverseListener
for catching Returns, Tabs and Previous Tabs.

Is this really the wisest way to do it?

Henry

"Henry Barnett" <hba@quartetfs.com> wrote in message
news:dq5meb$obb$1@utils.eclipse.org...
> Hi,
>
> I have a Table, with three TableColumn's, the first is a name, and the
> last is a buttom, the center is a regular cell.
> Whenever a row gets selected the middle row changes to a widget depending
> on the value in the first row.
> So, I have a selectionListener on the table which creates a TableEditor
> and specific widget and populates it.
> My problem is that I wish the user to be able to use Tab and/or the down
> arrow, to cycle through the rows in the table.
> Soon I realised that using table.select() and table.setSelection() don't
> send SelectionEvents, but I am wondering how if there is already a
> workaround or an easier way than say, sending my own type of event?
>
> Any help is welcome.
>
> Thank you
> Henry
>
Re: Table selection event [message #466663 is a reply to message #466660] Thu, 12 January 2006 14:59 Go to previous message
Yves Harms is currently offline Yves HarmsFriend
Messages: 80
Registered: July 2009
Member
You could use TableCursor to implement navigation by keyboard.
See the class javadoc of TableCursor or the SWT snippets for an example:
http://www.eclipse.org/swt/snippets/

I dont know however if Tablecursor supports navigation with tabulator.

Yves
Previous Topic:how can i make the "uninstall" item available?
Next Topic:Detect Right mouse click
Goto Forum:
  


Current Time: Sat Dec 14 15:43:15 GMT 2024

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

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

Back to the top