Board index » cppbuilder » same line in Memo

same line in Memo


2004-11-06 06:06:40 AM
cppbuilder1
Hi!
Does anyone know how to get the text on the same line when adding text to a
Memo object
I want to copy selected items from a listview to a Memo object and obviously
want the ones that are on the same row in the listview to be on the same
line in the Memo. I tried Append but it puts it on another line eventhough
the help files says that it should append the text to the end of the text in
the Memo
Appends a string to the end of the memo's text.
void __fastcall Append(const WideString Text);
Description
Use Append to add the string, specified by the Text parameter, to the end of
the existing text in the memo control.
Thanks, Jani
 
 

Re:same line in Memo

"Jani Ruohomaa" < XXXX@XXXXX.COM >wrote in message
Quote
Does anyone know how to get the text on the same line
when adding text to a Memo object
What do you mean?
Quote
I want to copy selected items from a listview to a Memo object
and obviously want the ones that are on the same row in the
listview to be on the same line in the Memo.
Are you saying that you your ListView has multiple columns, and you want the
columns of a single list item to be on the same line together in the Memo?
If so, then simply append the values together before you add them to the
Memo. For example:
TListItem *Item = a selected item in the ListView;
AnsiString s = Item->Caption;
for(int i = 0; i < Item->SubItems->Count; ++i)
s += (" " + Item->SubItems->Strings[i]);
Memo->Lines->Append(s);
Quote
I tried Append but it puts it on another line eventhough the help files
says that it should append the text to the end of the text in the Memo
The documentation is correct. Append() does add the new text to the end of
the control - making a new line as needed.
Gambit
 

Re:same line in Memo

Hi!
Thanks, that did the trick!
Jani
"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote

"Jani Ruohomaa" < XXXX@XXXXX.COM >wrote in message
news: XXXX@XXXXX.COM ...

>Does anyone know how to get the text on the same line
>when adding text to a Memo object

What do you mean?

>I want to copy selected items from a listview to a Memo object
>and obviously want the ones that are on the same row in the
>listview to be on the same line in the Memo.

Are you saying that you your ListView has multiple columns, and you want
the
columns of a single list item to be on the same line together in the Memo?
If so, then simply append the values together before you add them to the
Memo. For example:

TListItem *Item = a selected item in the ListView;

AnsiString s = Item->Caption;
for(int i = 0; i < Item->SubItems->Count; ++i)
s += (" " + Item->SubItems->Strings[i]);

Memo->Lines->Append(s);

>I tried Append but it puts it on another line eventhough the help files
>says that it should append the text to the end of the text in the Memo

The documentation is correct. Append() does add the new text to the end
of
the control - making a new line as needed.


Gambit


 

{smallsort}