Thread: caret repositions itself

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Dec 2010
    Location
    Delhi, India
    Posts
    59

    caret repositions itself

    I am trying to manipulate caret position in an edit control using Winapi SetCaretPos() function. When the user clicks on a button, the caret in the edit box advances a certain number of pixels forward(its like inserting a blank automatically). Till here everything goes fine, and the caret blinks at its new position, but when I try to write anything in the edit box now, it goes back to the previous place before the automatic space. Any suggestions on how can I skip certain space in edit box?
    A few lines of code:
    Code:
    length=GetWindowTextLength(Fill_Blanks_Enter_Question_Edit);
    SetFocus(Fill_Blanks_Enter_Question_Edit);
     GetCaretPos(&Cursor_Pos);            //Cursor_Pos is of type LPPOINT
     SetCaretPos(Cursor_Pos.x + 50,Cursor_Pos.y);
    The caret flashes at the right position, but I am not able to write at that position.
    Last edited by Salem; 07-26-2011 at 03:14 AM. Reason: line wrapping

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Rich Edit Control - Get And Set Caret Position?
    By Charles01 in forum Windows Programming
    Replies: 1
    Last Post: 12-05-2005, 10:26 AM
  2. Move the Caret to a line
    By TheDan in forum Windows Programming
    Replies: 3
    Last Post: 08-07-2005, 12:59 PM
  3. How to show Blinking caret?
    By loko in forum C Programming
    Replies: 2
    Last Post: 07-13-2005, 02:53 AM
  4. The Caret
    By Rez in forum Windows Programming
    Replies: 3
    Last Post: 11-25-2002, 08:02 PM