ComboBox change notification requires de-selection

Posted by: lars-fp on 8 September 2017, 2:48 pm EST

  • Posted 8 September 2017, 2:48 pm EST

    Anyone happen to know if  there a way to allow comboboxes to react to a change in value immediately (i.e. not have to wait until the user de-selected the cell)?

     I'd like to trigger an immediate response.

     Thanks!

  • Replied 8 September 2017, 2:48 pm EST

    Hello,

    The ComboBoxCellType has a EditorValueChanged event which is fired as soon as the value in the ComboBox is changed, either by selecting a new value from the DropDown list or by typing into the editable portion of the ComboBoxCellType cell. You can make use of this event to trigger an immediate response.

    Hope it will help you. Please let me know if you have any queries further.

    Thanks,

    Manpreet Kaur.

  • Replied 8 September 2017, 2:48 pm EST

    Hello,

    Yes, you can even use the ComboCloseUp event to notify as soon as the changes are made to the ComboBoxCellType cell, however this event would be fired only when a new value is selected from the DropDown  list, it would not be fired when the value in the ComboBox is changed by typing in the editable portion of the ComboBox. So, depending on your requirements you can choose any one of these events.

    Please let me know if you have any queries further.

    Thanks,

    Manpreet Kaur.

  • Replied 8 September 2017, 2:48 pm EST

    Hello, could you please provide a sample code using this event?
  • Replied 8 September 2017, 2:48 pm EST

    Hello,

    I am attaching a sample depicting the working of ComboCloseUp event. In the sample, as soon as you select a value by clicking on the drop down arrow in the cell, whose celltype is set to ComboBoxCellType, the ComboCloseUp event is fired and it displays the selected item in a MessageBox.

    Hope it will help you. Please let me know if you have any queries further.

    Thanks,

    Manpreet Kaur


    2011/12/comboevents.zip
  • Replied 8 September 2017, 2:48 pm EST

    Hello:


    this thread started with a question to catch an event when combo selection is being changed. Attached code uses ComboCloseUp which will pop-up a message box every time user make a selection in the combo (whether new selection is the same or has been changed).  In order to accomplish that code can use a variable to store latest selection and compare it with selected item in ComboCloseUp event. But the question is : is there a way to accomplish it without using an additional variable to store latest selection.


    Thank you

  • Replied 8 September 2017, 2:48 pm EST

    This seems to work too. 

     spread.ComboCloseUp += new FP.EditorNotifyEventHandler(this.spread_ComboChanged);  

           // Need to invalidate entire style when combobox changes, so that display updates properly
            private void spread_ComboChanged(object sender, FarPoint.Win.Spread.EditorNotifyEventArgs e)
            {
                // Find the data row associated with this change
               {code}

                // Invalidate all rows within this style
                do
                {
                    spread.ActiveSheet.Rows[row].Invalidate();
                    row++;
                }
                while (.{loop on rows}..)

                spread.EditMode = false;
            }

     

     

  • Replied 8 September 2017, 2:48 pm EST

    Hello,

    Yes, you are right you would need to make use of a variable to store the previously selected value, to compare it with the currently selected value so that we could know if the selected value is a new value, or the user selected the same value again. You could make use of the ComboDropDown event to get the previously selected value and ComboSelChange event to get the currently selected value and later perform a comparison between the two. I am attaching a sample depicting the same, in which as soon as the value is changed, the changed value is added to the ListBox in the form.

    Kindly have a look at the attached sample. Hope it will help you. Please let me know if you have any queries further.

    Thanks,

    Manpreet Kaur. 


    2011/12/comboselchange.zip
Need extra support?

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

Learn More

Forum Channels