Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/15/08 05:54
Read: times


 
#153324 - Maybe this will help
Responding to: ???'s previous message
Hi Chris,

You've shown a bit of code. I suppose it's extracted from some event handler function that's magically called by the MFC framework. Is that correct? If so, which handler function is it? If not, what then?

In any case, following is a snippet that supposedly tells how to set the cursor position in a CEdit control. I say "supposedly" because I haven't verified myself that it works as advertised. I grabbed it from the Code Project article found here. Maybe some of the rest of that article will help you, too.

-- Russ
/*  The caret (cursor) can be placed in the Edit Control by
    calling the SetSel() with the start and end position
    being the same.  */

//  Place caret at end of text

    UpdateData();
    int len = m_strEdit5.GetLength();
    m_Edit5.SetFocus();            // or you won't see it
    m_Edit5.SetSel(len,len);
PS: If you poke around for any length of time on the Code Project website, you will eventually come across some articles by a guy named Joseph Newcomer. He has a website of his own that is full of what strikes me as good and helpful advice and information. Some that you might find useful in your present situation is here. Look on that page for links to essays on "Avoiding UpdateData()" and "Dialog Box Control Management".



List of 18 messages in thread
TopicAuthorDate
C++, 8051, cleaning up a mess......need advise            01/01/70 00:00      
   Trying to convert after typing is too hard            01/01/70 00:00      
   Take a look here...            01/01/70 00:00      
      I gave that a run,            01/01/70 00:00      
   Maybe this will help            01/01/70 00:00      
      Thanks Russ, some thoughts            01/01/70 00:00      
         More thoughts            01/01/70 00:00      
            Your right, you know how it is            01/01/70 00:00      
      Is this it?            01/01/70 00:00      
         Well, no            01/01/70 00:00      
            Hopefully I can answer this correctly            01/01/70 00:00      
               Is Prosise onlin?            01/01/70 00:00      
                  Emailed link to you            01/01/70 00:00      
               Two more questions            01/01/70 00:00      
                  Placeholders for array data            01/01/70 00:00      
               Stop now, before you make things worse!            01/01/70 00:00      
                  No offense taken at all            01/01/70 00:00      
                     I got the link            01/01/70 00:00      

Back to Subject List