开发者

Problem with TAdvMemo component (about wordwrap)

开发者 https://www.devze.com 2023-04-07 13:46 出处:网络
I am using TAdvMemo. My problem is with the WordWrap property. It works very well when I type text in the text area, but when I add a string to it in code, it has no effect.

I am using TAdvMemo. My problem is with the WordWrap property. It works very well when I type text in the text area, but when I add a string to it in code, it has no effect.

I have set WordWrap property to: wwRightMargin and RightMargin property to 80, but not see other property that ca开发者_运维知识库n help me, so i ask some idea as solve it?

i mean for example:

AdvMemo.Lines.Add(MyString);

where MyString is a string as: 'hello word'. When it is longer than 80 chars, and wrap is enabled, it should wrap to a new line, but instead it's all on the same line.


Try using AdvMemo.InsertText instead. Lines.Add doesn't care about wrapping, it just handles some special chars in the string.


After you added text to adv memo you must update wrap by calling UpdateWrap() function. Here is an example for you:

AdvMemo.Lines.Add(MyString);
AdvMemo.UpdateWrap();

or

AdvMemo.Lines.Text(MyString);
AdvMemo.UpdateWrap();

Be sure that WordWrap property of Adv Memo is different than wwNone.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号