View previous topic :: View next topic |
Author |
Message |
mike_girkin
Joined: 11 May 2011 Posts: 7
|
Posted: Tue Oct 02, 2012 12:30 pm Post subject: Problems with edit mode |
|
|
Hello!
We have two problems using VirtualGrid (v. 4.3)
1. Escape key handling in edit mode. We use controls with some validation logic in behind (implementing Validating and Validated events). The problem is, when the Esc key is pressed, and control validation fails (Validating event CancelEventArgs.Cancel = true) editing control is hidden, but the focus stays in it, this cause our application to "hang", because there is no avail to move focus anywhere. How should we implement validation, or override Esc key handling to get the appropriate behavoiur (Esc key pressed, and even the value in the editor failed the validation, editor is closed, and focus is returned to the grid)?
2. How could we determine whether the control in edit mode or not? Our grid uses the "Del" key for deletion of rows. But it receives this event even in edit mode, when the "Del" key is supposed to delete the symbol in the editor. Is there any way to find out the mode of the grid, or to block this event propagation for the given key? |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Wed Oct 03, 2012 5:04 am Post subject: |
|
|
If you could you put together a small project (or modify one of the Virtual Tree sample projects) that demonstrates the issue(s) you are having, that would help us greatly find a solution for you. You can email a zipped copy of the project to support@infralution.com. _________________ Infralution Support |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Mon Oct 08, 2012 12:02 am Post subject: |
|
|
Thanks for the sample project. From your email you have fixed the first issue so only the second issue remains. This is actually normal (although annoying) behaviour for .NET forms. See this thread on stackoverflow:
To fix the issue override the ProcessCmdKey on the form containing Virtual Tree like this:
Code: | protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == Keys.Delete)
{
if (virtualTree1.EditRow != null)
return false;
}
return base.ProcessCmdKey(ref msg, keyData);
} |
This checks if Virtual Tree is editing and if so disables the normal key handling that would be done for the context menu. _________________ Infralution Support |
|
Back to top |
|
|
|