• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 133
  • Last Modified:

TRichEdit control, doesn't allow me to change Alignment

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
JasonC
Asked:
JasonC
  • 2
1 Solution
 
rwilson032697Commented:
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
 
JasonCAuthor Commented:
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
 
BlackManCommented:
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
 
JasonCAuthor Commented:
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now