It what order does the grid process the various KeyActionMappings collections owned by its child objects?
I have overriden the EditorWithMask class and am attempting to add a new NextSection mapping, but it never seems to get processed. I believe some other child element of the grid has a conflicting mapping, but I can't figure out what it is.
If you can't supply the order, do you have any hints as to the best way to troubleshoot the issue?
Thanks!
Hi,
Can you explain exactly what you are trying do to with your new mapping? What is the behavior you want?
Off the top of my head, I think if a cell is in edit mode then the grid should be asking the editor to process the key first and the grid should only process that key if the editor does not, but the Tab key is very tricky, since the form also handles this key to navigate between controls.
I might be easier to handle the grid's KeyDown event of handle BeforePerformAction. But it's very hard to guess without knowing what you are trying to achieve.
Sorry it has been so long. I found a way to reduce the pain for the editor that started the post, but it has come back in a different spot.
Basically we have two decimal columns that the users would like to enter through a third column as a single string in the form of: Decimal1{space}X{space}Decimal2. On that third column I have put a mask of "nnn.n X nnn.n". The data is extremely frustrating to enter as there by default is no intuitive way to move from section or skip a section. The least painful way to do the entry is to always enter the full numbers...including the decimal and the digit to the right of the decimal, however you still need to hit the space bar (instead of the user expected "X") to get to Decimal2. It is also really easy to mess things up by hitting tab or left arrow that you might expect to work to move to the next section.
I did try adding the x to the KeyActionMappings for the editor...attempting to emulate the behavior of Ctrl-Right...but it does not behave the same way...and I am at a loss as to how to troubleshoot it and figure out the best way to make it all work.
Idealy we would like the user to be able to enter a string like 12x14 and have the final result be 12.0 X 14.0...but any movement in the right direction would be helpful
I am attaching a simple example app to illustrate.
Ideas?
I don't think KeyActionMappings are the right way to go here. KeyActionMappings are useful for navigation or special functions, but I would not use them for something like there where you are entering data in a cell.
My advice would be to use the KeyDown event. That way, you have total control over exactly what happens whenever any key is pressed and you can control the exact cursor position (via the SelectionStart and SelectionLength properties of the cell).
Another option would be for you to write your own control - maybe using two TextBoxes on a UserControl. Then you could handle the KeyDown/KeyPress/KeyUp events of the TextBoxes and the UserControl to get the behavior you want. Then you embed that control in the grid cell using the UltraControlContainerEditor.
Thanks...that seems to work fine.
Sometimes brute force is better than finesse I guess.
Thanks