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 

Sizing a RichEdit

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Using
View previous topic :: View next topic  
Author Message
Jon Jacobs
Guest





PostPosted: Thu Oct 23, 2003 9:02 pm    Post subject: Sizing a RichEdit Reply with quote



I need to set the size of a RichEdit so that it is just large enough not to
need scroll bars, unless the size reaches a predetermined max. Actually I
set the size of the form, and the RichEdit is alClient.

First I get the number of lines (MyRichEdit.Lines.Count), and calculate a
suitable width. I enlarge the form width appropriately.

Then I get the number of lines again to calculate the height I need for the
form. The number or lines, of course, has decrease because the control is
wider. However, I still get the original number of lines from
MyRichEdit.Lines.Count. Even if I clear the control and reassign the text.

What do I need to do to get the correct number of lines for my height
calculation? Or is there another way to determine the height of all the
text? Note that the text never contains CR or LF.

Thanks,
Jon


Back to top
Peter Below (TeamB)
Guest





PostPosted: Fri Oct 24, 2003 6:42 pm    Post subject: Re: Sizing a RichEdit Reply with quote



In article <3f9841b1$1 (AT) newsgroups (DOT) borland.com>, Jon Jacobs wrote:
Quote:
I need to set the size of a RichEdit so that it is just large enough not to
need scroll bars, unless the size reaches a predetermined max. Actually I
set the size of the form, and the RichEdit is alClient.

First I get the number of lines (MyRichEdit.Lines.Count), and calculate a
suitable width. I enlarge the form width appropriately.

Then I get the number of lines again to calculate the height I need for the
form. The number or lines, of course, has decrease because the control is
wider. However, I still get the original number of lines from
MyRichEdit.Lines.Count. Even if I clear the control and reassign the text.

What do I need to do to get the correct number of lines for my height
calculation?

Just handle the OnResizeRequest event, it tells you how high the control
needs to be.


--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be



Back to top
Jon Jacobs
Guest





PostPosted: Sat Oct 25, 2003 2:26 am    Post subject: Re: Sizing a RichEdit Reply with quote



Thank you,
Jon

"Peter Below (TeamB)" <100113.1101 (AT) compuXXserve (DOT) com> wrote

Quote:
In article <3f9841b1$1 (AT) newsgroups (DOT) borland.com>, Jon Jacobs wrote:
I need to set the size of a RichEdit so that it is just large enough not
to
need scroll bars, unless the size reaches a predetermined max. Actually
I
set the size of the form, and the RichEdit is alClient.

First I get the number of lines (MyRichEdit.Lines.Count), and calculate
a
suitable width. I enlarge the form width appropriately.

Then I get the number of lines again to calculate the height I need for
the
form. The number or lines, of course, has decrease because the control
is
wider. However, I still get the original number of lines from
MyRichEdit.Lines.Count. Even if I clear the control and reassign the
text.

What do I need to do to get the correct number of lines for my height
calculation?

Just handle the OnResizeRequest event, it tells you how high the control
needs to be.


--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be





Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Using 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.