 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Jon Jacobs Guest
|
Posted: Thu Oct 23, 2003 9:02 pm Post subject: Sizing a RichEdit |
|
|
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
|
Posted: Fri Oct 24, 2003 6:42 pm Post subject: Re: Sizing a RichEdit |
|
|
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
|
Posted: Sat Oct 25, 2003 2:26 am Post subject: Re: Sizing a RichEdit |
|
|
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 |
|
 |
|
|
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
|
|