I want to be able to move a column that is not currently selected : To click on a column header and be able to drag it right away instead of having to click on a column and click on it again to start a column drag operation.
One way to do this would be to derive a custom mouse controller to handle the move based on the current mouse controller that handles the default moving of the columns. But that class is internal, so you would essentially have to copy it and modify it directly in your project. If you have the source code version, then you could do this.
Attached is another approach. It overrides OnMouseDown, OnMouseMove and OnMouseUp in a derived grid to affect this behaviior directly. Here is a rough (very rough) sample that does this. It uses a helper class (DragHelper) available to you from the shared library to manage drawing the visual quese as you move the column. Maybe something like this would work for you (when cleaned up).
Though the sample uses a derived grid to get at the MouseDown, MouseUp and MouseMove actions, you probably can do something similar just handling those events on the grid.
OCOlivier ChoquetteApril 11, 2003 10:46 AM UTC
I tried what your code and it works great! (give or take one or two typos ;).
Is there a reason why the DragHelper class was left out of the documentation?
thanks for the timely response!