How can I set the caret position in a edit cell?

The following sample code shows you how to set the current cell to a specific cell, make the cell active and position the caret. The code also works if the cell is already active.

   // Position current cell (optional)
SetCurrentCell(15, 2);
   CGXEditControl* pControl = (CGXEditControl*) GetCurrentCellControl();
   // Make sure this is a CEdit
   if (pControl->CGXControl::IsKindOf(CONTROL_CLASS(CGXEditControl)))
   {
      // Set Active and position caret
      pControl->SetActive(TRUE);
      pControl->SetSel(5,5);
      // Refresh will set the focus to the CEdit
      pControl->Refresh();
   }