MagicFoundation / Alcinoe

Alcinoe Component Library For Delphi. Full opengl video player, WebRTC delphi wrapper, native ios/android TEdit, Improuved firemonkey controls, Firebase cloud messaging, Android/ios facebook sdk login, Json/Bson Parser, ImageMagick wrapper, MongoDb client And much more
Apache License 2.0
998 stars 220 forks source link

[REQ] TALMemo - Add Text property ( Text lines ) #353

Open maurobotta opened 1 month ago

maurobotta commented 1 month ago

Hi,

For TALMemo, i can't found a "add / Items.add" only a Text ( simple string )

I have much code with OldMemo.Lines.Add('xxxxx') , and is not easy to convert.

Best Regards

Mauro

Zeus64 commented 1 month ago

The issue arises because the concept of "lines" can be confusing. As the text wraps inside the memo, when you use OldMemo.Lines.Add('xxxxx'), it doesn't necessarily mean you're adding one visible line to the memo; it could span multiple lines. Similarly, retrieving Memo.Lines[5] (for example) doesn't necessarily correspond to the visible line number 5 in the memo. That's why a memo primarily has a Text property instead of focusing on Lines.

Would it be possible for you to replace OldMemo.Lines.Add('xxxxx') with OldMemo.Text := OldMemo.Text + #13#10 + 'xxxxx'; ?

maurobotta commented 1 month ago

Would it be possible for you to replace OldMemo.Lines.Add('xxxxx') with OldMemo.Text := OldMemo.Text + #13#10 + 'xxxxx'; ?

Yes, of course, but is complicate. Memo.Items.Add is very popular line of code.

Zeus64 commented 1 month ago

I know but it's really a bad logic, only on delphi you can see it :( but yes it's possible to fake the Items, it's would be very simple to do by editing the alcinoe.fmx.memo.pas and add it. it's will be a simple fake TstringList that simple read the text property or set the text property.