Re: Delphi TEdit-alignment

Posted by WAllison on November 30, 2001

In Reply to: Re: tedit-alignment posted by webmaster Guido on September 25, 2001

: The text of a TEdit is always left aligned, you can't change that.
: But here's a trick: use a TMemo instead of a TEdit, because you can change its alignment in the Object Inspector (left-justify, center, right-justify). If you want it to behave like a TEdit, you have to limit its maximum number of lines to 1, like this:
: - set MaxLength to a relatively small number, e.g. 25;
: - set WantReturns to FALSE (no end-of-lines can be entered by pressing ENTER);
: - set WantTabs to FALSE ((no tabs can be entered by pressing TAB).

Alternatively - you could create another TEdit component - copying the properties of the parent. Just add Property Alignment (in published section); - its just not published - same as align - i'll send you source if you need it. If anybody knows any reason why this shouldn't be done by all means let me know.


[ DelphiLand FAQ ] [ Delphi Tutorials ]