[Gambas-user] Drag & Drop ListView selection, does not work

T Lee Davidson t.lee.davidson at gmail.com
Sat Sep 24 22:43:56 CEST 2022

On 9/23/22 16:58, gian via User wrote:
> In this test if you try to move by dragging it with the left mouse button an Item to another Item the first Item will take the 
> position of the other Item which will move together with all those that precede (or follow) it by one position.
> My intent is to obtain, along with the displacement, a correct selection of the displaced Item.
> The selection happens correctly only after the third attempt, from there on it works fine, why?

I am finding the same behavior.

After the very first drag and drop operation, *something* is causing the internal item cursor to be set to the original position 
of the dragged item, and the item now in that position is also selected. It is as if the ListView is attempting to maintain the 
GUI state of the container. An iteration of the System.Backtrace collection, coded within the ListView1_Select event handler, 
indicates it may be related to GridView.TimerScroll_Timer.1202.

That internally-forced selection is repeated with every press of the keyboard down-arrow and can only be overcome by manually 
making a selection with the mouse. Once it is overcome, the behavior is as expected.

I think there is nothing you can do to alleviate that anomalous behavior, Gianluigi. I think we need someone like Benoît to 
confirm the behavior of ListView/TreeView/GridView after Remove/Add or Drag/Drop operations.


More information about the User mailing list