Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 208
  • Last Modified:

Edit control selection

How can I get the text that I select in a multi-line edit control to scroll into view.
I'm using SetSel

Cheers
0
TSMITH
Asked:
TSMITH
  • 3
1 Solution
 
captainkirkCommented:
I would suspect that if you know the starting character index, you would call LineFromChar() to get the line number and then call LineScroll() to position you to where you want...
0
 
poohbear_68Commented:
m_MyEdit1.SendMessage(EM_SCROLLCARET);

This should do what you want.
0
 
poohbear_68Commented:
Maybe I crazy, or just a little weird, but don't both of these two options do the same thing?
0
 
TSMITHAuthor Commented:
Yes, they do. Thanks poohbear 68, but I had to award the points to captainkirk as his/her comment was submitted first. Also captainkirk's solution is MFC rather than SDK.
0
 
poohbear_68Commented:
Right.  No problem -- I fully understand.  So while we're at it anyhow, here's another way to do it!  :)  At least according to documentation, it works.   I guess I haven't tested it specifically.  <grin>

m_Edit.SetSel(m_Edit.GetSel(), FALSE);
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now