Disable Spacebar on combobox type control

Hello,
 
Currently spacebar key opens up dropdown control listing all items. I just wanted to block it off for this control type only in the grid. But it should be able to open up on mouse click.
 
How can i do this?
 
Thanks

1 Reply

VK Vinish Kumar K Syncfusion Team March 7, 2014 06:39 AM UTC

Hi Shailesh,

Thank you for your interest in Syncfusion products.

You can cancel the showing dropdown when key down. Please use the below codes in your application.

        void gridControl1_MouseDown(object sender, MouseEventArgs e)
        {
            int row, col;
            this.gridControl1.PointToRowCol(e.Location,out row,out col);
            this.gridControl1.CurrentCell.MoveTo(GridRangeInfo.Cell(row, col));
            GridComboBoxCellRenderer cc = this.gridControl1.CurrentCell.Renderer as GridComboBoxCellRenderer;
            if (cc != null)
                isKeyDown = false;
            else
                isKeyDown = true;
        }

        bool isKeyDown = false;
        void gridControl1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            GridComboBoxCellRenderer cc = this.gridControl1.CurrentCell.Renderer as GridComboBoxCellRenderer;
            if (cc != null)
                isKeyDown = true;
            else
                isKeyDown = false;
        }

        void gridControl1_CurrentCellShowingDropDown(object sender, GridCurrentCellShowingDropDownEventArgs e)
        {
            if (isKeyDown)
                e.Cancel = true;
        }

I hope this will resolve the issue in  your end. Please let me know if you have any concerns.

Regards,
Vinish K.


Loader.
Up arrow icon