This is a migrated thread and some comments may be shown as answers.

How to add Tab key as select value

1 Answer 67 Views
MultiColumn ComboBox
This is a migrated thread and some comments may be shown as answers.
Charles
Top achievements
Rank 1
Charles asked on 27 Jun 2011, 10:05 AM
When I type something such as "abb",   the "ABB Allentown" value is selected.
After that, the user press Enter key that value chosen.
I want to the TAB key work the same way.
Pls provide the alternative solution to achieve this functionality.

1 Answer, 1 is accepted

Sort by
0
Accepted
Martin Vasilev
Telerik team
answered on 30 Jun 2011, 08:37 AM
Hello Bang,

Actually, after some time spent on trying to find solution about your question, I have managed to discover one. You can create a custom MultiColumnComboBox control, which overrides ProcessCmdKey. In this event, if a tab press was detected - use ClosePopup method to close the drop down. Please consider the following code as example:
public class CustomMultiColumnComboBox : RadMultiColumnComboBox
{
    protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
    {
        switch (keyData)
        {
            case Keys.Tab:
                this.MultiColumnComboBoxElement.ClosePopup();
                break;
        }
         
        return base.ProcessCmdKey(ref msg, keyData);
    }
}

I hope this helps. Let me know if you have any additional questions. 

All the best,
Martin Vasilev
the Telerik team
Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.
Tags
MultiColumn ComboBox
Asked by
Charles
Top achievements
Rank 1
Answers by
Martin Vasilev
Telerik team
Share this question
or