Click here to Skip to main content
15,898,689 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an rtf control in a dialog and the rtf file is loaded using EM_STREAMIN. The text appears selected. How can I prevent this ?
RaymondM
Posted
Comments
Sergey Alexandrovich Kryukov 12-Dec-13 17:40pm    
Which RTF control do you use? What's the platform? Are you using MFC, or System.Windows.Forms or WPF with C++/CLI, or what?

Typically, selection is set by setting offset "selection start" and "selection length"; you can set both to zero.
You can use raw Windows messages to do that.
—SA

1 solution

Please see my comment. As I don't know what you are using on what platform, I can tell you how can you do it on Windows with raw API.

You can use the message EM_EXSETSEL; set CHARRANGE members to the values you need, for example to zero, to unselect:
http://msdn.microsoft.com/en-us/library/windows/desktop/bb788007%28v=vs.85%29.aspx[^],
http://msdn.microsoft.com/en-us/library/windows/desktop/bb787885%28v=vs.85%29.aspx[^],
http://msdn.microsoft.com/en-us/library/windows/desktop/ff486015%28v=vs.85%29.aspx[^].

If you use different platform or UI framework, you know the idea; find out how selection is controlled.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900