Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
325
Preventing tab and mouse click in UltraGrid
posted

I am subclassing the UltraGrid to create a read only Grid in my WInForms. I want to prevent tab and mouse clicks inside individual cells. I was able to prevent tab navigation by using the following inside my class

protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            switch (keyData)
            {
                case Keys.Tab:
                    {
                        this.TopLevelControl.SelectNextControl(this, true, true, true, true);
                        return true;
                    }
           }
           return base.ProcessCmdKey(ref msg, keyData);
  }

 

I also want to prevent the user from clicking on a cell and effectively cancelling the event. can someone

show me some possible solutions?

 

Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted

    I'm not sure exactly what you are trying to do here. But it looks like you might be jumping through some unnecessary hoops here.

    If you want the tab key to move to the next control rather than tabbing between rows or cells, all you have to do is set the TabNavigation property on the grid. You might also want to remove any reference to the Tab key from the KeyActionMappings collection.

    rpgCoder said:
    I also want to prevent the user from clicking on a cell and effectively cancelling the event. can someone

    This statement doesn't really make sense. You can't stop the user from clicking on a cell. You can prevent the results of the click. But what result are you trying to prevent? You can use the CellClickAction property to determine what happens when the user clicks on a cell. You can use the Activation or CellActivation property to disable cells. You could disable the whole grid. There are any number of possible solutions depending on what you want.

Children