number celltype

Posted by: lier on 8 September 2017, 1:35 pm EST

  • Posted 8 September 2017, 1:35 pm EST

    in a number cell type, when i enter the cell the cursor goes to the place before the decimal place by default.


    how can i change it so that the cursor goes to the end by default.


    eg . currently if a number cell type contain a value say 12.3456 and when ienter the edit mode by pressing the enter or backspace button the cursor is placed after 2 and not after 6.


     


     

  • Replied 8 September 2017, 1:35 pm EST

    thanks,


    the above code apply the property to entire spread sheet. can u help me to get  the same behaviour for any paticular column.

  • Replied 8 September 2017, 1:35 pm EST

    Hello,


    This is correct behavior of the number celltype editor. If you want the cursor in a different location, you would need to programatically put it there.


    Dim t As New Timer


    Private Sub FpSpread1_EditModeOn(ByVal sender As Object, ByVal e As System.EventArgs) Handles FpSpread1.EditModeOn


    Dim g As FarPoint.Win.Spread.CellType.GeneralEditor


    g = FpSpread1.EditingControl


    AddHandler t.Tick, AddressOf MoveCursor


    t.Interval = 100


    t.Start()


    End Sub


    Public Sub MoveCursor(ByVal sender As Object, ByVal e As System.EventArgs)


    Dim g As FarPoint.Win.Spread.CellType.GeneralEditor


    g = FpSpread1.EditingControl


    g.SelectionStart = g.Value.ToString.Length


    t.Stop()


    End Sub

  • Replied 8 September 2017, 1:35 pm EST

    thanks for the help . i'll try it.


     however can u send me the code in c# .

  • Replied 8 September 2017, 1:35 pm EST

     Timer t = new Timer();

    private void fpSpread1_EditModeOn(object sender, EventArgs e)
    {
    FarPoint.Win.Spread.CellType.GeneralEditor g;
    g = (FarPoint.Win.Spread.CellType.GeneralEditor)fpSpread1.EditingControl;
    t.Tick += new EventHandler(MoveCursor);
    t.Interval = 1000;
    t.Start();
    }

    void MoveCursor(object sender, EventArgs e)
    {
    FarPoint.Win.Spread.CellType.GeneralEditor g;
    g = (FarPoint.Win.Spread.CellType.GeneralEditor)fpSpread1.EditingControl;
    g.SelectionStart = g.Value.ToString().Length;
    t.Stop();
    }

  • Replied 8 September 2017, 1:35 pm EST

    This will always apply it to the entire spread. You could try querying the ActiveColumn of the spread and if it meets your criteria apply the code but even then it will apply it to the entire spread.  You could try using the EditModeOff event to change the behavior back to its default.
  • Replied 8 September 2017, 1:35 pm EST

    ok, thanks
  • Replied 8 September 2017, 1:35 pm EST

    i got the solution using the following  code in the edit mode on event  :-


    FarPoint.Win.Spread.CellType.GeneralEditor t;


    t = (FarPoint.Win.Spread.CellType.GeneralEditor)fpEvents.EditingControl;


    t.EditModeCursorPosition = FarPoint.Win.EditModeCursorPosition.End;


    but when i copy any decimal value from an excel file and paste it to the cell, the value is not pasted.But when i copy any value from any other cell of the same spread it get pasted.


    how can i achieve this property.


     


     


     

  • Replied 8 September 2017, 1:35 pm EST

    Hello,


    I am not able to reproduce this issue. Could you post a small zipped project reproducing this behavior for us to debug?

Need extra support?

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

Learn More

Forum Channels