Solved

RichEdit Control

Posted on 2000-03-14
8
462 Views
Last Modified: 2013-11-20
Hi,

I am trying to use a RichEdit Control on my dialog because I need to change the edit controls background colour...

I'd like the control to be read only, right aligned text and in Upper case only. I have tried to set these properties when in the reseource editor. I found that the read only checkbox worked but it disables the ability to change the alignment and the Uppercase checkbox doesn't do anything...

Is there another way of setting these properties.. I have looked through all the methods on the control and can't find any. Also is it possible to change the font size of the text being displayed..

thanks in advance..
0
Comment
Question by:middlel
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 4

Expert Comment

by:captainkirk
ID: 2616645
Did you check the "multiline" property?
0
 
LVL 4

Accepted Solution

by:
captainkirk earned 102 total points
ID: 2616665
Also you can set the font:

CFont f;
f.CreateFont(<set your params for the font in here>);
m_RichEdit.SetFont(); // m_RichhEdit is your control...


be sure to call AfxInitRichEdit() in your app's InitInstance()...
0
 

Author Comment

by:middlel
ID: 2616814
I have made sure that the control is intialised, you can always tell if AfxInitRichEdit() hasn't been called because the dialog does not display. :-)
I don't want the edit control to have multiple lines, but when I tried it made no difference.

However, when I unchecked the automatic horizontal scroll, and the multiple lines state was also checked, the edit control aligned properly ... weird..

I still haven't figured out how to get the edit to display UPPERCASE no matter what is entered??

I'll try the font stuff..

thanks

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 8

Expert Comment

by:gelbert
ID: 2616835
Overwrite OnChar() and convert every character to upper case there
0
 
LVL 4

Expert Comment

by:captainkirk
ID: 2616838
I missed a point here - if the rich edit is read only, just setting the uppercase property is not going to work, because, that only converts typed-in text to uppercase. If you use SetWindowText(), you'll do the conversion yourself, maybe like a variant of this:

CString csText = _T("here's some lowercase text...");
csText.MakeUpper();

m_RichEdit.SetWindowText(csText);
0
 

Author Comment

by:middlel
ID: 2616891
I get passed the text from somewhere else and I thought it would be nice if when I Set the text it would automatically just convert it... ;-)

I'll just add a check to make sure that it is uppercase..

Cheers!

Emma
0
 

Author Comment

by:middlel
ID: 2619210
It all works great now!

thanks a lot..

Emma
0
 
LVL 4

Expert Comment

by:captainkirk
ID: 2620161
glad you're doing OK...
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question