We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Disable Spacebar on combobox type control

Thread ID:

Created:

Updated:

Platform:

Replies:

115934 Feb 28,2014 01:37 AM Mar 7,2014 01:39 AM Windows Forms 1
loading
Tags: GridDataBoundGrid(Classic)
Shailesh Shivappa
Asked On February 28, 2014 01:37 AM

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

Vinish Kumar K [Syncfusion]
Replied On March 7, 2014 01:39 AM

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.


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;