Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to align numbers in TEdit

Status
Not open for further replies.

hennep

Programmer
Dec 10, 2000
429
I expected a property to align numbers to the right in a TEdit control but I cannot find anything.
Is there a way to do this in TEdit or do I have to use another control?

thanks,
Hennie
 
The only way I know of is to use a non-proportional font and insert enough spaces at the left until it looks right-aligned.

I wrote a custom edit component a few years ago with a right-align property, which uses that method.
 
Thanks Tony,

I find it hard to believe that Borland does not supply an alignment option in the TEdit box.
Either your solution or using the TMemo control can solve this problem. The TMemo control has an alignment property.
When I use the TMemo, I may need to do some additional programming, I have to disable the use of the enter key for instance.

 
Thanks James,

Creating a new control is definitely the best solution. But I think I will choose the less work option by using a TMemo with key event to disable the enter key.

Hennie
 
use a tmemo

TMemo *memo1;

memo1->Height = 21;
memo1->Length = 75;
memo1->Alignment = taRightJustify;
memo1->MaxLength = 10;

gets the job done!!!!!!

tomcruz.net
 
setting the maxlength property does away with any
work disabling the enter key.

tomcruz.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top