Solved

RichEdit Control

Posted on 2000-03-14
8
455 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
Comment Utility
Did you check the "multiline" property?
0
 
LVL 4

Accepted Solution

by:
captainkirk earned 102 total points
Comment Utility
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
Comment Utility
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
Comment Utility
Overwrite OnChar() and convert every character to upper case there
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 4

Expert Comment

by:captainkirk
Comment Utility
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
Comment Utility
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
Comment Utility
It all works great now!

thanks a lot..

Emma
0
 
LVL 4

Expert Comment

by:captainkirk
Comment Utility
glad you're doing OK...
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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 tutorial demonstrates a quick way of adding group price to multiple Magento products.

743 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

10 Experts available now in Live!

Get 1:1 Help Now