Click here to Skip to main content
16,001,979 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hi,

I use CGridCtrl and I want to move the Cursor position in a Cell.
How can i do this?

thanks for help
Martin
Posted
Updated 25-Apr-10 22:21pm
v2

Try it :) :
{
...
  CRect cCellRect;
  GetCellRect(iRow, iCol, cCellRect);
  if (ClientToScreen(cCellRect)) {
    SetCursorPos(cCellRect.left +1,
                 cCellRect.top  +1);
  }
...
}



Mt Morph wrote:
but there is noch function GetCellRect(iRow,iCol,cCellRect)


Why are you thinking so ? :)

Mt Morph wrote:
Now i want the cursor being between these both words ?

Would it be a correct result ? :) :
CGridCellBase* pcCell = GetCell(GetFocusCell());
if (pcCell) {
  CEdit* pcEdit = DYNAMIC_DOWNCAST(CEdit, pcCell->GetEditWnd());
  if (pcEdit) {
    pcEdit->SetSel(5, 5);
  }
}
 
Share this answer
 
v3
Ok, forget it I found the function ;)

The problem is that with your answer i can Move the cursor.
I think I specified the problem a little bit wrong.

I want to move the editcursor in a cell.
For example:
The cell contains the Text "Hello World ". If the Cell gets the focus the editcursor is on the last position of the text. -> "Hello World |"

Now i want the cursor being between these both words.
Thats my problem.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900