Table selection event [message #466658] |
Thu, 12 January 2006 13:43 |
Henry 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 |
Henry 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
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.03803 seconds