I have a problem using a DateTimePickerExt in a grid cell. I derived a cellmodel and cellrenderer and all works fine.
But the problem is:
I step through the values with the arrow keys and if I''m at the right most field and press the right arrow key the selection moves to the left most field and not to the next cell.
Is there a way around this?
ADAdministrator Syncfusion Team April 14, 2004 12:09 AM
The DataTimePickerAdv processes the arrow keys at this point, and this is why you see this behavior, They wrap within the control. You face the same problem with the up and down arrows. They do not navigate the grid either, but spin the field value.
One comment is the the Tab key seems to move off the DateTimePicker cell if you are using the code from a Grid forum post.
If you want to change this behavior, you will have to derive the DateTimePickerAdv control, and override ProcessCmdKey. In Your override, if you are on the right field and the key is Key.Right, then you would just return false. This would pass the key back to the grid which would then handle it. If you are using the code from the grid forum, the DateTimePickerAdv is already derived, and ProcessCmdKey is overridden to pass the keys.Enter back to the grid. But the problem with the Keys.Right is that I cannot see any exposed way to determine when you are on the right-most field. And without this knowledge, you would not be able to get things to work as you want. Maybe someone else will post on how you might be able to determine when you are on the right-most field.
ADAdministrator Syncfusion Team April 14, 2004 04:01 AM
Unfortunatelly the property "SelectedField" is a private property in the control, so I can''t access the value to check in which field I am...
So it seems like there is no chance to get the correct arrow key behaviour for the right and left arrow key. For the up and down arrow key I handled it - in the derived class.
ADAdministrator Syncfusion Team April 14, 2004 04:19 PM
We have now added a protected virtual bool JumpField() method to the DateTimePickerAdv control. When the marginal field is selected and the opposite key is pressed (right field is selected and right key is pressed or same with left) this method gets called. If it returns true (default value) the field jumps to the other end and it behaves as before, but if it returns false the key event is passed on and the next field is not selected. This feature will be available in the next release of Essential Suite. Please let me know if you need any other information.