BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TEdit Centering Text

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage)
View previous topic :: View next topic  
Author Message
LarryJ
Guest





PostPosted: Mon Apr 17, 2006 10:03 pm    Post subject: TEdit Centering Text Reply with quote



Is it possible to center the Text in a TEdit? I don't see a property to
align the text.

Thanks
Larry
Back to top
JD
Guest





PostPosted: Tue Apr 18, 2006 6:03 am    Post subject: Re: TEdit Centering Text Reply with quote



"LarryJ" <LarryJ33 (AT) austin (DOT) rr.com> wrote:
Quote:

Is it possible to center the Text in a TEdit?

Yes, but not reliably.

Quote:
I don't see a property to align the text.

There isn't one. You need to apply ES_CENTER to it's GWL_STYLE.
For example:

::SetWindowLong( Edit1->Handle, GWL_STYLE, ::GetWindowLong(Edit1->Handle, GWL_STYLE) | ES_CENTER );

Keep in mind that if the underlying HWND is ever recreated,
you'll lose the ES_CENTER to you should override it's
CreateParams method instead. However, IIRC, Win98 and below do
not support center or right alignment on single line controls.

If you need to support all OS's, you need to use a multi-line control instead.

~ JD
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.