Board index » cppbuilder » Displaying in Memo

Displaying in Memo


2004-04-21 06:35:59 AM
cppbuilder74
Hi i have a small program which displays 5 numbers from 0 - 5, the code is:
for( int i = 0; i < 5; i++ )
{
Memo->Lines->Add(IntToStr(i));
}
The output in memo is:
0
1
2
3
4
How to display the output in this format?
0 1 2 3 4
thanx for all your help
undbund
 
 

Re:Displaying in Memo

undbund < XXXX@XXXXX.COM >wrote:
Quote
Hi i have a small program which displays 5 numbers from 0 - 5, the code is:
That would be 6 numbers <g>
Quote
[...] How to display the output in this format?
0 1 2 3 4
Add adds a line. What you want to do is to format a single line and it:
int Limit = 5;
AnsiString s = "";
for( int i = 0; i < Limit; ++i )
{
s += IntToStr( i );
if( i < Limit - 1 ) s+= " ";
}
Memo->Lines->Add( s );
~ JD
 

Re:Displaying in Memo

"undbund" < XXXX@XXXXX.COM >wrote in message
Quote
How to display the output in this format?
0 1 2 3 4
Alternatively to what JD suggested:
for( int i = 0; i < 5; i++ )
{
Memo->SelStart = Memo->GetTextLen();
Memo->SelLength = 0;
Memo->SelText = IntToStr(i) + " ";
if( i < 4 )
{
Memo->SelStart = Memo->GetTextLen();
Memo->SelLength = 0;
Memo->SelText = " ";
}
}
Gambit
 

{smallsort}