Mindy
June 4th, 1999, 01:10 PM
I'm using Dundas's grid control, and am trying to implement a type-ahead feature for drop down boxes. I've gotten fairly far, but I am having a problem with moving the caret. Here's what I am doing:
pWndEdit->SetWindowText(strTemp);
CPoint point;
CSize size;
CDC * pDC;
pDC = pWndEdit->GetDC();
size = pDC->GetTextExtent(m_strCurrent);
point = pWndEdit->GetCaretPos();
point.x += size.cx;
pWndEdit->HideCaret();
pWndEdit->SetCaretPos(point);
pWndEdit->ShowCaret();
I read somewhere that you should hide, reposition, and then show the caret, but it didn't seem to help... If I do a GetCaretPos() just after this, the position is correct, but it never moves in the display. Anybody got any ideas? pWndEdit is just a CWnd and not a CEdit, so I don't have nice features like SetSel.
Thanks so much for your help!!!
Mindy
pWndEdit->SetWindowText(strTemp);
CPoint point;
CSize size;
CDC * pDC;
pDC = pWndEdit->GetDC();
size = pDC->GetTextExtent(m_strCurrent);
point = pWndEdit->GetCaretPos();
point.x += size.cx;
pWndEdit->HideCaret();
pWndEdit->SetCaretPos(point);
pWndEdit->ShowCaret();
I read somewhere that you should hide, reposition, and then show the caret, but it didn't seem to help... If I do a GetCaretPos() just after this, the position is correct, but it never moves in the display. Anybody got any ideas? pWndEdit is just a CWnd and not a CEdit, so I don't have nice features like SetSel.
Thanks so much for your help!!!
Mindy