Solved

TRichEdit control, doesn't allow me to change Alignment

Posted on 1998-11-19
4
124 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
[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
  • 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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to debug For loops? 3 72
JAudiorecorder record freezing the app 29 90
Firemonkey Listview item popup menu ? 1 71
TlistView is Really heavy on Android 3 42
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

739 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