textBox - 2 questions  
Author Message
Yosef Karasik





PostPosted: Visual C++ General, textBox - 2 questions Top

Hi all.

I have a textBox controler in my win app that i write in c++.

I insert data into the textBox in runtime.

2 Questions:

1) Is it possible to insert the data in LIFO

that means that if i insert line "bla bla bla" then new line and then "yada yada yada" it will appear as

yada yada yada

bla bla bla

Is it possible without clearing the box each time, writing new line and then filling with old data. (I have a lot of info and after a while the screen updates slow)

2) If the first question is answered and the data is inserted in LIFO, is it possible to show only the last X lines

As i mentioned i have a lot of data comming in but only the last data is the relevant to see...

Thanks ahead

Yosef K.



Visual C++4  
 
 
Ovidiu Cucu





PostPosted: Visual C++ General, textBox - 2 questions Top

I have a textBox controler in my win app that i write in c++

First of all, please, can you explain us what's a "textBox controler"



 
 
Yosef Karasik





PostPosted: Visual C++ General, textBox - 2 questions Top

A text box in visual studio 2005...

It enables you to add text.. I use it as the output destenation. That means whenever i need to output something, I add it to the text box

textBox1->text += "bla bla bla"; (example)


 
 
smaryus





PostPosted: Visual C++ General, textBox - 2 questions Top

Try
textBox1->text = "ybla" + textBox1->text;

or

var = textBox1->text ;
textBox1->text = "ybla" + var;


 
 
Yosef Karasik





PostPosted: Visual C++ General, textBox - 2 questions Top

I was doing that, but after you have a lot of data it takes time to refresh becaus if I use

textBox1->text = "ybla" + textBox1->text;

It filles each time the text box...

How about my second question Anyone !


 
 
Viorel.





PostPosted: Visual C++ General, textBox - 2 questions Top

In my opinion, in order to insert a line to the beginning of a large text, first place the cursor:< xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

textBox->SelectionStart = 0;

textBox->SelectionLength = 0;

Then insert the text using this:

textBox->SelectedText = "New line of text\r\n";

In order to limit the number of lines to three, consider this:

if( textBox->GetLineFromCharIndex(textBox->TextLength) > 3)

{

    textBox->SelectionStart = textBox->GetFirstCharIndexFromLine(3);

    textBox->SelectionLength = textBox->TextLength - textBox->SelectionStart;

    textBox->SelectedText = "";

    textBox->SelectionStart = 0;

}

I hope it works.


 
 
Yosef Karasik





PostPosted: Visual C++ General, textBox - 2 questions Top

Have to go home, will try it on Monday and respond.

Any other sudgestions are still welcome...

Great weekend ya all.