Click to See Complete Forum and Search --> : Flexgrid column re-ordering


jngregg
September 27th, 1999, 01:05 PM
I'm new to using flexgrid controls and I need to know if it is possible to re-order the contents of a column inside the grid.

For instance if the column had contents 1, 2, 3, 4, 5 I want to be able to dragdrop cells to re-order them so the contents read 1,5,2,3,4

I don't want to overwrite the cells, but rather move everything else down. The columns are independent of each other so the ordering of one column does not effect the order of the other columns. The dragdrop event seems to only apply to the whole grid, not the cells inside the grid. Any suggestions?

J. N. Gregg
Sr. Software Analyst
=======================
Intergraph Corporation
Federal Systems
DCAFE R&D Test

Chris Eastwood
September 27th, 1999, 02:17 PM
Hi

It is possible to implement this behaviour with the standard FlexGrid - I've done it for a previous project I worked on.

The FlexGrid has a .ColPos(ition?) property - the way I handled it was such :

1. On MouseDown in FlexGrid
- Check which row / column you are over (.MouseRow / .MouseCol) and
store that value - miDragCol
- If in a fixed Row then set an internal 'mbDragging' variable to true

2. On MouseMove/MouseUp
- If button is held down and 'mbDragging' is true
- set the '.ColPos' of the 'miDragCol' to the '.mouseCol' position

I'll post some code to the site when I get a chance - but this should be enough to help you get started.


Chris Eastwood

CodeGuru - the website for developers
http://codeguru.developer.com/vb