Board index » delphi » word wrap

word wrap

Hi,
how can I word warp in a TMemo, is there
any component?
--
Met vriendelijke groeten / With kind regards,
Sam Francke
 

Re:word wrap


Quote
"Sam Francke" <s.j.fran...@hccnet.nl> wrote in message

news:396F3335.C009D602@hccnet.nl...

Quote
> Hi,
> how can I word warp in a TMemo, is there
> any component?

Memo1.WordWrap := true;

Christo Crause

Re:word wrap


Quote
> > how can I word warp in a TMemo, is there
> > any component?

> Memo1.WordWrap := true;

sorry, and sorry for the e-mail, my question was not correct,
I mean, how do you write a function/procedure
in Delphi to word wrap?

Met vriendelijke groeten / With kind regards,
Sam Francke.

Re:word wrap


Im Artikel <396F4DB5.4C9B3...@hccnet.nl>, Sam Francke <s.j.fran...@hccnet.nl>
schreibt:

Quote
>I mean, how do you write a function/procedure
>in Delphi to word wrap?

Did you realize, that word wrapping will affect the line count? This means,
that your procedure must handle one or more chunks of text, and then must
determine how many lines will be required to display that text.

The remaining tasks are simple:
- one function determines, where (wrappable) words exist in a given text
- one function computes the width of one or more of these words
- one function determines, how many of these words fit into a line
- the last function determines, how many lines result from a given text

Then you split the text into lines, using the above functions, set the line
count of the Memo and the contents of every line accordingly.

What's the problem?

DoDi

Re:word wrap


"VBDis" <vb...@aol.com> skrev i melding
news:20000715204258.06864.00006535@nso-fp.aol.com...
Quote
> Im Artikel <396F4DB5.4C9B3...@hccnet.nl>, Sam Francke

<s.j.fran...@hccnet.nl>

Quote
> schreibt:

> >I mean, how do you write a function/procedure
> >in Delphi to word wrap?

> Did you realize, that word wrapping will affect the line count? This means,
> that your procedure must handle one or more chunks of text, and then must
> determine how many lines will be required to display that text.

> The remaining tasks are simple:
> - one function determines, where (wrappable) words exist in a given text
> - one function computes the width of one or more of these words
> - one function determines, how many of these words fit into a line
> - the last function determines, how many lines result from a given text

> Then you split the text into lines, using the above functions, set the line
> count of the Memo and the contents of every line accordingly.

Actually, DrawText WinAPI may actually do this kind of calaculation (even
without drawing anything). One of the dwFlag members to be set is DT_CALCRECT
or similar.

--
Bjoerge Saether
Consultant / Developer
Asker, Norway
bsaether.removet...@online.no (remove the obvious)

Re:word wrap


Quote
"Sam Francke" <s.j.fran...@hccnet.nl> wrote in message

news:396F4DB5.4C9B3AB5@hccnet.nl...

Quote
> > > how can I word warp in a TMemo, is there
> > > any component?

> > Memo1.WordWrap := true;

> sorry, and sorry for the e-mail, my question was not correct,
> I mean, how do you write a function/procedure
> in Delphi to word wrap?

There are an awful lot of different ways to do this, and short of the very
simple solution shown above its can actually be a complicated subject.
Perhaps if you explained where you are having trouble we could be more
helpful.

Re:word wrap


Why write a procedure ? The Sysutils unit already has a function WrapText
for that !

"Sam Francke" <s.j.fran...@hccnet.nl> schreef in bericht
news:396F4DB5.4C9B3AB5@hccnet.nl...

Quote
> > > how can I word warp in a TMemo, is there
> > > any component?

> > Memo1.WordWrap := true;

> sorry, and sorry for the e-mail, my question was not correct,
> I mean, how do you write a function/procedure
> in Delphi to word wrap?

> Met vriendelijke groeten / With kind regards,
> Sam Francke.

Other Threads