We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Cursor Positioning on focus in a grid cell

I have a grid (grdPhone) comprized of three columns - phone number, type (Combobox) and comments. The phone number cell has a mask of (999) 999-9999.

Currently when a user clicks on the phone cell their position is set to the spot they click. How can I force the position to be 2, immediately following the first paren?

Thanks!

Tom

2 Replies

AD Administrator Syncfusion Team August 8, 2006 08:05 PM UTC

Hi Tom,

You can handle the CurrentCellStartEditing event to place the cursor position as required in a cell by sending the Keys.

The following code snippet, handled the CurrentCellStartEditing event to move the cursor position to the second place in a cell by sending the Home and Right Keys.

// CurrentCellStartEditing event
SendKeys.Send("{HOME}");
SendKeys.Send("{RIGHT}");

Thanks,
Megavannan


TA Tom Affholter April 25, 2007 04:30 PM UTC

Now that I am a bit more knowledgable in this matter I need to point out that you threw me far off track with your answer. In fact, if I have properly coded the mask, my cursor should have automatically positioned itself at the correct position after the first paren. My problem was that I have coded the format correctly, but I had failed to include the text property "(___) ___-____".

What I do not understand is why the Microsoft datetime picker allows 2 or 4 digit years and provides slashes while yours doesn't (sort of does with limitations). Using Syncfusion's advdatetimepicker for example, I can format only to one century. If I enter '97', I want 1997, not 2097. It should read +/- 50 years. Anything after 40 should return 1900 + the 2 digit year. Anything under 40 should return 2000. We are too close to the turn of the century. I might be mistaken, but I believe this is how the MS datetime works. Assuming logically you extended MS datetime picker, why would you override these features?

My solution was to scrap your control for Microsoft's. But I am giving up some nice features.

Thanks,

Tom

Loader.
Live Chat Icon For mobile
Up arrow icon