Skip to main content



      Home
Home » Eclipse Projects » NatTable » Stop horizontal scrolling when extending selection mit Down-key
Stop horizontal scrolling when extending selection mit Down-key [message #1853618] Mon, 11 July 2022 10:29 Go to next message
Eclipse UserFriend
Hello together,

I have the following problem:

I configured the table to use row-selection-mode.

When selecting a row - say on the first column - and then pressing the cursor down arrow key to select the next line, the table selects the second line too, but it always scrolls horizontally to the last column.

This is very annoying for our users. How to prevent this and keep staying on the initially selected column?

Thanks in advance,

Klaus

[Updated on: Mon, 11 July 2022 10:30] by Moderator

Re: Stop horizontal scrolling when extending selection mit Down-key [message #1853621 is a reply to message #1853618] Mon, 11 July 2022 11:01 Go to previous messageGo to next message
Eclipse UserFriend
After a quick look I suppose the issue is in SelectionLayer#getCellPositionToMoveFrom(). This doesn't really care about the selection model. It simply checks for the modifier keys and the current selection, and then takes the last selected cell in the area for further processing. But this triggers a CellSelectionEvent that then triggers the scrolling to the last column as last selected cell in the selection area.

That method is protected, so you should be able to override it as a quick fix.

Or it is MoveRowSelectionCommandHandler#moveLastSelectedDown() that should fire a CellSelectionEvent without an updated column in case of row only selection bindings. In that case you could register your own handler to avoid the scrolling.

Apart from that, please create a ticket. This should be fixed in the code base somehow. But for this I need to investigate deeper.
Re: Stop horizontal scrolling when extending selection mit Down-key [message #1853637 is a reply to message #1853621] Tue, 12 July 2022 02:02 Go to previous messageGo to next message
Eclipse UserFriend
I just noticed that the easiest fix might be to activate the AXIS_CYCLE_TRAVERSAL_STRATEGY

        viewportLayer.registerCommandHandler(
                new MoveCellSelectionCommandHandler(selectionLayer, ITraversalStrategy.AXIS_CYCLE_TRAVERSAL_STRATEGY));


But that of course also activates the traversal that for example on pressing key down at the last row in the table, the selection anchor will jump to the first row (axis cycle traversal). If that behavior is not wanted, the fix will be more complicated.
Re: Stop horizontal scrolling when extending selection mit Down-key [message #1853664 is a reply to message #1853637] Wed, 13 July 2022 02:50 Go to previous messageGo to next message
Eclipse UserFriend
Hello Dirk,

thank you for your fast answer. I filed a bug report, as you told me.
Cause the nat table is wrapped in one of our interal components, I will now try to get the nattable's viewport layer and register the command handler as you suggested.

Thanks and greetings,
Klaus
Re: Stop horizontal scrolling when extending selection mit Down-key [message #1853665 is a reply to message #1853637] Wed, 13 July 2022 03:24 Go to previous messageGo to next message
Eclipse UserFriend
I have created a ticket: https://bugs.eclipse.org/bugs/show_bug.cgi?id=580368

A have also found a fix and added some test cases to verify that it works and does not break anything. Would be great if you could verify if the fix works.
Re: Stop horizontal scrolling when extending selection mit Down-key [message #1853701 is a reply to message #1853665] Thu, 14 July 2022 01:58 Go to previous messageGo to next message
Eclipse UserFriend
Dirk,

please note, that the problem also appears, when the user selects all rows with Ctrl-A.

BTW: I implemented an Override of getCellPositionToMoveFrom, which works great for me. When 2.0.3 is out I will have a look onto it.

Thanks again,

Klaus
Re: Stop horizontal scrolling when extending selection mit Down-key [message #1853712 is a reply to message #1853701] Thu, 14 July 2022 08:21 Go to previous message
Eclipse UserFriend
Quote:
When 2.0.3 is out I will have a look onto it.


That is sad to hear actually. If you only verify AFTER a release was done, how do you expect the feature to be really fixed soon? It should be verified BEFORE the bugfix release, to be sure everything works and there are no regressions. Actually I just noticed that I broke the left/right movement on row selection mode accidentially by fixing the scrolling issue.
This is fixed now, together with the select all scrolling issue. But it would be very good if you could verify it before the next bugfix release!

Are you aware that we provide SNAPSHOT builds for early verifications?
https://download.eclipse.org/nattable/snapshots/

#35 contains the latest fixes regarding the row selection and scrolling issues
Previous Topic:User resizing of columns is wrong
Next Topic:Classloading issue with slf4j and nattable
Goto Forum:
  


Current Time: Sat May 24 13:21:23 EDT 2025

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

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

Back to the top