How to select just a cell in the header area (with a click of the mouse)

Posted by: luigggye-fp on 8 September 2017, 2:25 pm EST

  • Posted 8 September 2017, 2:25 pm EST

    Hi,


    I want to perform a drag and drop operation between a header cell and other cell in the sheet.


    But if I do a click in any header cell, the column is selected, instead the cell that I clicked. (see the attached picture)


    Why this is happening?


    How to select just a cell in the header area (with a click of the mouse) in order to drag it to another cell of the sheet?


    Thanks in advance,


    Luigggye 


     



  • Replied 8 September 2017, 2:25 pm EST

    Hello,

    Header cells are not selected as they are not included in the data area. It is not allowed to make a header cell as active cell. As a work around you may remove the default header and use the first Row/Column as ColumnHeader/RowHeader.

    Thanks,

     

     

     


  • Replied 8 September 2017, 2:25 pm EST

    Thanks for your response.


    It's mean that I can't drag a header cell and drop it to another cell in the header or data area?


    Thanks in advance,


    Luigggye

  • Replied 8 September 2017, 2:25 pm EST

    Luigggye,

    As suggested by Deepak, you need to hide the Spread's default header and then make the first Row/Column as the header of the Spread and then you can drag and drop the cells, else in case you want to drag and drop default header cells, then it will move the complete Column rather than the single header cell.

    Thanks.
  • Replied 8 September 2017, 2:25 pm EST

    Thanks for your responses.


    As suggested by you, I already have hidden the header and then I have used the first Row/Column as a header.


    I have read all the information about drag and drop existing in the Farpoint forum, but all this information was entered few years ago. So I am confused about the correct way to do that.


    So, I really need a sample about drag and drop between cells.


    I will perform the drag and drop operation only over the data area (because the header area is hidden) and I have used the first rows / columns as the header.


    I want to drag a cell (a single cell, not a range of cells) and drop it in other area of the sheet.


    The idea is:


    Click the cell with the left buttom of the mouse and when I start to move the mouse, the drag operation must to start.


    When the left buttom of the mouse is released, the source data must be placed in the target cell. (text and tag properties).


    During the drag operation is in progres I always must to know about which cell is in pointer of the mouse. (I will do a few checks and possibly deny the drop).


    When the mouse is released (the drop operation is started), I want to know the source cell as well as the target cell, because I must to perform some process (delete a column or row, add a column or row... etc).


    I will appreciate so much if you can show me a sample.


    Thanks in advance,


    Luigggye 


     

  • Replied 8 September 2017, 2:25 pm EST

    Hello,

    In order to allow DragDrop you need to set AllowDragDrop property to True, later using Spread's DragDropCompleted event you should be able to get the Row and Column index for the cells to/from the drag drop happened.

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            FpSpread1.AllowDragDrop = True
        End Sub

     Private Sub FpSpread1_DragDropBlockCompleted(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.DragDropBlockCompletedEventArgs) Handles FpSpread1.DragDropBlockCompleted
            MsgBox(e.ColumnBegin & e.RowBegin & e.RowEnd & e.ColumnEnd)
     End Sub

     I hope it will help you.

    Thanks,

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels