Difference in ComboBox Celltype events Firing

Posted by: rprabhu on 8 September 2017, 2:24 pm EST

  • Posted 8 September 2017, 2:24 pm EST

    Hi All,

     

              Consider in VB, Spread.EditEnterAction property is set to 2. The equivalent in C# is InputMaps are set.

              In VB Spread, selecting an item from combobox celltype fires spread_change and spread_leavecell events and gives focus to next cell. But in C#, selecting an item from combobox celltype does not fire these events.

     

              We can track the selection in C# by looking for spread’s EditChange event, but it only fires if we select each time a different item in the list. Then to give focus to next cell, am manually passing the ‘Enter’ key.

     

    Following is the code snippet of EditChange event,

     

              FarPoint.Win.Spread.CellType.ComboBoxCellType c = (FarPoint.Win.Spread.CellType.ComboBoxCellType)fpSpread1.ActiveSheet.ActiveCell.CellType;

              c.StopEditing();

              SendKeys.Send("\r");

     

    Is there any cleaner method of doing this? I have attached the sample’s for VB and C#.


     

    Thanks,

    Prabhu R


    2010/07/Samples.zip
  • Replied 8 September 2017, 2:24 pm EST

    Hello Prabhu,


    EditEnter event is Spread for COM is bit different from InputMap in Spread for WinForms wherein EditEnter event occurs whenever we edit the cell and press enter whereas InputMap for Enter key will only fire whenever we will press EnterKey in Spread and not when we edit the Spread cells.


    However, in Spread for WinForms EditChange event doesn't occur whenever we make the same selection from the combobox dropdown, it only occurs whenever the user changes the text in a cell in edit mode. So instead of sending carriage return key in EditChange event i would suggest you to SendKey in ComboCloseUp event.



         void fpSpread1_ComboCloseUp(object sender, FarPoint.Win.Spread.EditorNotifyEventArgs e)
            {
                FarPoint.Win.Spread.CellType.ComboBoxCellType c = (FarPoint.Win.Spread.CellType.ComboBoxCellType)fpSpread1.ActiveSheet.ActiveCell.CellType;
                c.StopEditing();
                SendKeys.Send("\r");
            }


    Hope this will you. Thanks.

Need extra support?

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

Learn More

Forum Channels