I currently have an UltraGrid control, which has multiple bands. When I'm on a band[0] line I want to be able to add keyboard shortcuts (such as ALT+C or ALT+P) to add a new row to one of the child bands. I've figured out the code to add the row to the desired child band, expand to the new row and activate edit mode on it; however I still can't find a satisfactory way to do this from the keyboard.
During my investigations I found the ability to add a GridKeyActionMapping, however the things that are performed seem to be limited to the list of events, so my query is - can I somehow override this to fire a method of my own?
Or, is there a better/different way of doing what I'm trying to achieve?
Many thanks in advance for your help.
Hello Martin,
In order to add a new row to a specific child band using a keyboard combination you could use the KeyDown event of the UltraGrid. When you press the desired combination this event is fired and according to the combination a method which adds the new row to a specific child band is called. Using a switch statement in the body of the KeyDown event gives you the opportunity to clasp other combinations that perform other methods.
I’ve implemented this suggestion in a simple sample, and you could run and evaluate it, please see attached zip.
Please let me know if you have any further questions.
@Mike - Thanks for your response, I had assume that that would be the case.
@Atanas - Thanks also for your reply and example code. It's a while since I've coded in C# so can you just confirm that the following code does what I think it does:
*SNIP* case Keys.Alt | Keys.N: DoWork(ref e); *SNIP*
*SNIP*
case Keys.Alt | Keys.N: DoWork(ref e);
Essentially, this case fires if the ALT key OR the N key are pressed? Rather than the ALT key AND the N key? I've tried multiple different ways of coding this, including using e.Modifiers.Alt and still can't get it to work properly - this is more likely due to the language I'm using (I'm programming in a language called OpenEdge - GUI for .NET) rather than the code itself as logically I would expect the code to work.
Thanks both for your assistance!
This case fires when you press both the ALT key and the N key. The ALT key is a special key and it can be only interpreted and transmitted when using dual-character combinations. I have chosen the Alt + N combination for your scenario but you can choose whatever combination you want:
case [ special key like Shift,Alt,Ctrl] | [a key]
Please do not hesitate to contact me if you have any further question.
I am just checking about the progress of this issue. Let me know If you need my further assistance on this issue?
Thank you for using Infragistics Components.