Hi swati505.
You could change your code so that the text box is not updated with each line. You could, for example, do it in a timer callback. You will need to embed newline characters in your buffer.
// Get the number of visible lines for the text box
GetCtrlAttribute (panel, control, ATTR_VISIBLE_LINES, &visible);
...
// This goes in your loop
strcat (textBuffer, "%s\n", newText);
...
// Periodically update the text box and clear the buffer
SetCtrlAttribute (panel, control, ATTR_CTRL_VAL, textBuffer);
textBuffer[0] = 0;
// Check how many lines are now in the box
GetNumTextBoxLines (panel, control, &lines);
// Scroll to the last line of text
SetCtrlAttribute (panel, control, ATTR_FIRST_VISIBLE_LINE,
lines > (visible - 1)? lines - visible + 2: 0);
Regards,
Colin.