[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: TraverseListener

The arrow keys already select the next item in a table, you do not need to 
override the traversal behaviour to achieve this.  Instead of trying to do 
this in a Traverse listener why not do it in a Selection listener?

The reason you are seeing the old selection is because in the Traverse 
event, the operating system has not yet processed the arrow key event and 
has not yet assigned the new selection.

"zinc" <zincsterio@xxxxxxxxx> wrote in message 
news:0f3cd02ea853877e3e1aef9c61a4b29a$1@xxxxxxxxxxxxxxxxxx
> Hi,
> I'm trying to implement a feature where in a table, when you press the 
> arrow keys (up or down) it goes to the next row selects the data and does 
> something with it.  However, when I try to get selection (by 
> getSelection()[0].getData()) it always returns the previous row's 
> information.
>
> For example, say I'm currently at row 1, and I press down arrow key.  The 
> selection goes to row 2 now.  When I get the current selection in the 
> attached TraverseListener, it returns the data for row 1.  So there is 
> always a phase difference of 1 in the selection.  Can anyone give some 
> tips as to how I may address this?
>
> Thanks.
>