CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Threaded View

  1. #1
    Join Date
    Mar 2003
    Location
    SA
    Posts
    147

    CaretPos vs. CharacterPos

    I am trying to figure out a way to "insert" text in an editbox, but doing this programatically, using the current position of the editbox.

    The MSDN states that CaretPos can be used to determine the current position of the Caret, eg.

    POINT ptChr;
    ptChr = m_edit_Action.GetCaretPos();

    so in turn

    ptChr.x <- will give me the current caret position of the editbox, but unfortunately the .x member of this current position points to an actual coordinate.

    How would I know where in the editbox the caretpos is ... so that I could manipulate the insertion of text as follows ...

    CString strInsertText("");
    m_edit_Action.GetWindowText(strInsertText);

    strInsertText.Insert(<Get current character position>, "INSERT TEXT");

    m_edit_Auction.SetWindowText(strInsertText);



    Actual text of the editbox ->

    ABC<The Caret is currently at the postion, after character 2, and before character 3>DEFG

    an the GetCaretPos() members returns 65 (which is actually pixels, or the actual x coordinate of the caret).

    [b]So how will I programarically be able to know that the caret is currently between character 2 and 3 ... ??

    Thanx in advance ...

    xIRC
    Last edited by xIRC; September 26th, 2003 at 11:18 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured