Keys Setting

Posted by: koustubh on 8 September 2017, 1:59 pm EST

  • Posted 8 September 2017, 1:59 pm EST

    1 ) I am using spread control for dot net 2.0 development. I required keys setting for enter key (same as in VB spread which is available in spread designer option    ---   In Spread Designer ---> General ---> Keys ---> Enter ---> Enter Key Action ---> Next ).


    can it is avalable with dot net spread? 


    2) If I have numerical editable cell with four decimal digits. If this cell contains data as 20.0000 when user press key to enter new value in to this cell I want 20 should disappers and cell should take user entered value. For Example when user types 40 the cell value should display 40.0000, but now it is displaying 2040.0000 for get my requirement what should I need to do?

  • Replied 8 September 2017, 1:59 pm EST

    Hello,

    1.You can map the keys to available actions.Below is the code snippet that map the Enter key to MovetoNextRow action,

    Dim inmap As New FarPoint.Win.Spread.InputMap()
    inmap = FpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenFocused)
    inmap.Put(New FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextRow)

    2.If you want to overwrite the value in cell while entering a new value, you can use FpSpread1.EditModeReplace = True.

     

    I hope it helps.

    Thanks,

     

     

  • Replied 8 September 2017, 1:59 pm EST

    Hello Sir,


    I have written the following inputMap to move on next row. But when my cell type is text cell it is not moving on the next row but comming down in the same cell. my project requirement is to move next row. What should I need to do for moving next row. 


    FarPoint.Win.Spread.InputMap im2 = new FarPoint.Win.Spread.InputMap();


    im2 = spdata.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused);


    im2.Put(new FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextRow);

  • Replied 8 September 2017, 1:59 pm EST

    Hello,

    I have tested the same at my side and it is working as expected for the TextCell type as well. Try changing the below snippet in your code

    im2 = spdata.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused);

    to the following snippet:

    im2 = spdata.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenFocused);

    You will notice a change in behavior and the expected behavior as well. In addition to this,I also found the following information from one of the old post, which should also be of some help.

    In the the DotNet framework, keystrokes are sent to the control with
    focus. The control with focus decides whether to process the keystroke
    immediately or to allow the keystroke to be processed by the parent
    control. If the control with focus processes the keystroke immediately
    then the parent control nevers sees the keystroke. 

    Thanks

     

  • Replied 8 September 2017, 1:59 pm EST

    Thanks for your reply.


    I have set input map methods for two different spread for two different forms. On one form it is working fine but in another form when user edit value and press enter it is not moving to next row but it is moving in the cell downword, for this spread I have also key press event.


    I am not able to reproduce this issue. Where I am going wrong please explain.

  • Replied 8 September 2017, 1:59 pm EST

    Hello,

    In order to move the focus to next row in the First column using Enter key in edit mode you can map the Enter key as follows

            Dim imap As New FarPoint.Win.Spread.InputMap()
            imap = FpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused)
            imap.Put(New FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextRowFirstColumn)

     

    I hope it helps,

    Thanks,

  • Replied 8 September 2017, 1:59 pm EST

    Hello Sir,


    Thanks for your reply. But I found the problem here I commented the cell type which is numerical.

  • Replied 8 September 2017, 1:59 pm EST

    Hello,

    It is working for the numerical cell type as well.Below is the code snippet to make the Enter Key action to move to next Row first Column while Column 0 to 4 are Numerical cell type.

            Dim num As New FarPoint.Win.Spread.CellType.NumberCellType
            FpSpread1.Sheets(0).Columns(0, 4).CellType = num
            Dim imap As New FarPoint.Win.Spread.InputMap()
            imap = FpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused)
            imap.Put(New FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextRowFirstColumn)

     

    Thanks,

  • Replied 8 September 2017, 1:59 pm EST

    Hello Sir,


    I have tried this and it is also not working for the following condition,


    When I set Multiline true for the text cell If I comments this multiline code it is working properly.


    but in this case I am not able to move in the cell with the help of arrow keys. When I press up arrow key the spread leaves the active cell.

  • Replied 8 September 2017, 1:59 pm EST

    Please refer to the following post by Scott to achieve your desired objective: http://www.clubfarpoint.com/Forums/forums/post/29926.aspx


    Thanks.

  • Replied 8 September 2017, 1:59 pm EST

    Thanx,


    It is working fine

Need extra support?

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

Learn More

Forum Channels