Solved

TRichEdit control, doesn't allow me to change Alignment

Posted on 1998-11-19
4
122 Views
Last Modified: 2010-04-04
When I try to change the alignment of a TRichEdit control at run time it doesn't work.

What's wrong with my code?
MyEditControl.Alignment := taCenter;


0
Comment
Question by:JasonC
  • 2
4 Comments
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1347384
The alignment property of a TRichEdit refers to the left, center or right alignment of text within it.

Use the Align property instead. Unfortunately the Align property doesn't let you center so you will need to adjust the top and left properties to center the component.

Cheers,

Raymond.
0
 

Author Comment

by:JasonC
ID: 1347385
I'm sorry you got the wrong impression, but I am trying to change the alignment of the text within the control.

This shuld work, I know, but it will only work if I change the properties in the design environment.
0
 
LVL 7

Accepted Solution

by:
BlackMan earned 100 total points
ID: 1347386
In a TRichEdit, as opposed to a TMemo, alignment works for a paragraph, so you'll have to select the text you want to align first.
Try
MyRichEdit.SelStart := 0;
MyRichEdit.SelLength := MyRichEdit.Text.Length

and then apply the alignment...

0
 

Author Comment

by:JasonC
ID: 1347387
These answers are good, but the problem I had was that the Alignment property does not seem to work unless the Align property has been set to something other than alNone.

Thanks for you responses.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

808 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