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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Disable Spacebar on combobox type control

Thread ID:

Created:

Updated:

Platform:

Replies:

115934 Feb 28,2014 06:37 AM UTC Mar 7,2014 06:39 AM UTC WinForms 1
loading
Tags: GridDataBoundGrid(Classic)
Shailesh Shivappa
Asked On February 28, 2014 06:37 AM UTC

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 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.


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.

Warning Icon 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.Close Icon

;