InputMap Issue - Replicating Formula Behavior

Posted by: d2.autoservicio on 24 February 2026, 11:19 am EST

  • Posted 24 February 2026, 11:19 am EST

    Hi,

    I’ve got the following set of code that I have in the Load Event, as I seek to replicate as much as possible the behavior of Excel with formulas.

    Dim im As New FarPoint.Win.Spread.InputMap

    'Define the operation of pressing Enter key in cells Not being edited as “Move to the next row”.

    im = FpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused)

    im.Put(New FarPoint.Win.Spread.Keystroke(Keys.F2, Keys.None), FarPoint.Win.Spread.SpreadActions.StartEditingFormula)

    im.Put(New FarPoint.Win.Spread.Keystroke(Keys.Back, Keys.None), FarPoint.Win.Spread.SpreadActions.ClearCell)

    im.Put(New FarPoint.Win.Spread.Keystroke(Keys.D0, Keys.Shift), FarPoint.Win.Spread.SpreadActions.StartEditingFormula)

    im.Put(New FarPoint.Win.Spread.Keystroke(Keys.Add, Keys.None), FarPoint.Win.Spread.SpreadActions.StartEditingFormula)

    im.Put(New FarPoint.Win.Spread.Keystroke(Keys.Oemplus, Keys.None), FarPoint.Win.Spread.SpreadActions.StartEditingFormula)

    im.Put(New FarPoint.Win.Spread.Keystroke(Keys.OemMinus, Keys.None), FarPoint.Win.Spread.SpreadActions.StartEditingFormula)

    However, this seems to not be working the first time. I am able to enter formulamode after the second time I try. For example, if I press “F2” key, the first time, editmode is activated, the second time and future times I press the “F2” key, FormulaMode is activated.

    I do have an EditModeStarting event

    Private Sub FpSpread1_EditModeStarting(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.EditModeStartingEventArgs) Handles FpSpread1.EditModeStarting

    If FpSpread1.ActiveSheetIndex = 0 Then

    FormulaOriginal = If(FpSpread1.ActiveSheet.ActiveCell.Formula, “”)

    ValorOriginal = FpSpread1.ActiveSheet.ActiveCell.Value

        If FormulaOriginal <> "" Then
            Formula = FormulaOriginal
        Else
            Formula = CStr(If(ValorOriginal Is Nothing, FpSpread1.ActiveSheet.ActiveCell.Text, ValorOriginal))
        End If
    
        If (FpSpread1.ActiveSheet.ActiveColumnIndex >= Columnas.ColConteoCajas And FpSpread1.ActiveSheet.ActiveColumnIndex <= Columnas.ColReconteoPiezas) Then
            FpSpread1.ActiveSheet.ActiveCell.CellType = New GeneralCellType
        End If
    End If
    

    End Sub

    This behavior only occurs with numeric cells, Text cells do start in formulamode since the first time.

  • Posted 25 February 2026, 7:19 am EST

    Hello,

    We are looking into this case and will get back to you with the updates soon.

    Regards,

    Prabhat Sharma.

  • Posted 25 February 2026, 11:08 pm EST

    Hello Jaime,

    Thank you for reaching out to Mescius Support.

    We have tried replicating the issue with your given code in the Number cell, but the issue did not occur. Please find the attached sample that we have tried at our end. For the Number celltype, the AllowUserFormulas is False by default, so we have updated it to True.

    Also, in your last given code, there are some unknown terms that we have commented in the sample. If they are required to replicate the issue, then please update the sample accordingly and share it back so that we can replicate the issue at our end.

    Regards,

    Prabhat Sharma.

    TestInputManDemo.zip

Need extra support?

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

Learn More

Forum Channels