CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 1999
    Location
    Huntsville, AL
    Posts
    1

    Flexgrid column re-ordering

    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

  2. #2
    Join Date
    May 1999
    Location
    Oxford UK
    Posts
    1,459

    Re: Flexgrid column re-ordering

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured