Solved

RichEdit Control

Posted on 2000-03-14
8
457 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
  • 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
 
LVL 8

Expert Comment

by:gelbert
ID: 2616835
Overwrite OnChar() and convert every character to upper case there
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

895 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now