MoveToNextRow not moving focus to next row when cell is a combobox

Posted by: rozensky on 8 September 2017, 3:10 pm EST

  • Posted 8 September 2017, 3:10 pm EST

    We have users that want to type in a combobox field and use the enter key to go to the next row in the same column. I tried the following code:

    InputMap im = GetInputMap(InputMapMode.WhenAncestorOfFocused);
    im.Put(new Keystroke(Keys.Enter, Keys.None), SpreadActions.MoveToNextRow);

    and this did not work. Is it possible to use the enter key in a combobox to go to the next row? We are using Farpoint
  • Replied 8 September 2017, 3:10 pm EST


    Please use the code below for the same wherein then combobox is editable as well as pressing Enter key moves the focus to next row in same column.

    private void Form1_Load(object sender, EventArgs e)
    FarPoint.Win.Spread.CellType.ComboBoxCellType cmbocell = new FarPoint.Win.Spread.CellType.ComboBoxCellType();
    cmbocell.Items = (new String[] { "January", "February", "March", "April", "May", "June" });
    cmbocell.AcceptsArrowKeys = FarPoint.Win.SuperEdit.AcceptsArrowKeys.AllArrows;
    cmbocell.AutoSearch = FarPoint.Win.AutoSearch.MultipleCharacter;
    cmbocell.Editable = true;
    cmbocell.ListAlignment = FarPoint.Win.ListAlignment.Left;
    cmbocell.ListOffset = 20;
    cmbocell.ListWidth = 0;
    cmbocell.MaxDrop = 4;
    fpSpread1.Sheets[0].Columns[2].CellType = cmbocell;
    fpSpread1.Sheets[0].Columns[2].Width = 120;

    FarPoint.Win.Spread.InputMap inputmap1;
    inputmap1 = fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused);
    inputmap1.Put(new FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextRow);
    FarPoint.Win.Spread.InputMap inputmap2;
    inputmap2 = fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenFocused);
    inputmap2.Put(new FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextRow);

    Hope it helps.

Need extra support?

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

Learn More

Forum Channels