Quantcast
Viewing all articles
Browse latest Browse all 12583

Horizontal scrolling in a CEdit without touching the selection

Hi,

I have a single line CEdit. The text it contains is longer than the width of the CEdit. If the user selects all of the text and leaves the CEdit then the end of the text is shown.

I want to show the beginning of the text when the CEdit loses focus.

It's possible to do this with SetSel(0, 0, FALSE); But this way I change the selection. I do not want that since I might need to access the selection the user made at a later time.

I tried writing the current selection in local variables, call SetSel(0, 0, FALSE); and then call SetSel(oldStart, oldEnd, TRUE);

I hoped setting the 3rd parameter to TRUE will not scroll to the caret. Unfortunately it does. The 3rd parameter seems to have no effect.

Does anybody have any idea how to make the 3rd parameter of SetSel work or how to horizontally scroll a CEdit without changing the selection?

Kind regards,

Max Trauth


Viewing all articles
Browse latest Browse all 12583

Trending Articles