I’ve been digging through the ListBox examples and watching “Good Guy Listbox”, but I don’t see an example of rubberband selection of cells such as we can do with Numbers/Excel.
The idea being that the user could start a mousedown and drag from one Cell to another cell with a rectangle of cells being selected between the mousedown and mouseup events.
[quote=355653:@Tim Jones]I’ve been digging through the ListBox examples and watching “Good Guy Listbox”, but I don’t see an example of rubberband selection of cells such as we can do with Numbers/Excel.
The idea being that the user could start a mousedown and drag from one Cell to another cell with a rectangle of cells being selected between the mousedown and mouseup events.
Has anyone done something like this?[/quote]
Not exactly but it can be done
If you want to show an outline of the selection box it would be more complicated but I think would be doable… If you just wanted to highlight the cells touched by the the rectangle without showing the rectangle that would be easier.
Thanks. That’s the route I was looking at, but I was waiting and depending on the tracking of the ending row and column. Handling the selection one cell at a time makes it work as the user drags and I don’t need to draw a rubberband of the selection as Karen mentions.
Thanks. That’s the route I was looking at, but I was waiting and depending on the tracking of the ending row and column. Handling the selection one cell at a time makes it work as the user drags and I don’t need to draw a rubberband of the selection as Karen mentions.[/quote]
BTW if are going to do such a UI, you should probably also allow doing such a selection by holding the shift key down and using the arrow keys.
[quote=355669:@Neil Burkholder]It seems like there should be a more efficient way to invalidate cells than looping through them all.
InvalidateCell(-1,-1) doesn’t work right as documented. Plain invalidate doesn’t do the trick either.[/quote]
And - it’s not a process hog since the user will only be doing in once in a while and maybe evern never once the configuration is done during initial setup.
I’m now working on this to allow the drag-selection as well as single click selection to work as I also need to interact with the CellCheck event. The management of Event Order and Event dependencies is turning out to be a true rat’s nest of code.
Short of trial and error, does anyone have a list that provides a hierarchy tree for the dependencies and order?
I had just thrown that together quick for an example. The code below actually allows selecting while the mouse is outside the grid.
Sub MouseDrag(x As Integer, y As Integer) Handles MouseDrag
Dim row As Integer = RowFromXY(1,y)
Dim col As Integer = ColumnFromXY(x,HeaderHeight+1)
If col > ColumnCount-1 Then col = -1 'because columns greater than column count can be returned
If row > -1 Then SelEndRow = row
If col > -1 Then SelEndCol = col
InvalidateAllCells
RaiseEvent MouseDrag(x,y)
End Sub