LTBOOL CLTGUIEditCtrl::OnLButtonUp(int x, int y) { if (!IsOnMe(x,y)) return LTFALSE; LT_POLYGT4* pPolys = m_pText->GetPolys(); uint16 nMax = m_pText->GetLength(); uint16 nIndex = 0; while (nIndex < nMax && x > pPolys[nIndex].verts[1].x) nIndex++; m_nCaretPos = nIndex; return LTTRUE; }
bool CLTGUIEditCtrl::OnLButtonUp(int x, int y) { if (!IsOnMe(x,y)) return false; uint32 nMax = LTStrLen(m_Text.GetText()); uint32 nIndex = 0; bool bFound = false; while (nIndex < nMax && !bFound) { LTRect2n rRect; if (m_Text.GetCharRect(m_nCaretPos-1,rRect) == LT_OK) { bFound = (x < rRect.Left()); } nIndex++; } m_nCaretPos = nIndex; return true; }