LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Text Boxes

Hi, I have a text which I write a lot of data to. At the end of writing, the text box is scrolled down to the bottom and I can't figure out how to programmically set back to top?

Secondly, is there a way of stoping the update of the text box while I'm writing to it so that the user doesn't see the box streaming by?

rjmiller
0 Kudos
Message 1 of 4
(3,579 Views)
Hi,

There is a attribute called ATTR_FIRST_VISIBLE_LINE that you can use to control the scroll bars. You set this attribute with the SetCtrlAttribute(,,,) on the control and the number that you pass is the first line that will be shown; just pass 0 and your scroll bar should go to the top.

To send data to the textbox without updating would require some tricks. One option is not to update the values in a callback, this way the draw events willbe suspended while the data is being sent to the text box; the problem here is that the UI becomes unresponsive in the mean time. Another option is to hide the textbox, send the data, put the scroll bar back at the top and show the text bow again; if you do this in a call back the screen will not flicker or anything and the us
er will not even notice that data is being added.

I hope this helps, let me know if you have any further questions.

Regards,

Juan Carlos
N.I.
Message 2 of 4
(3,580 Views)
To set the cursor position within a text box, you could use SetCtrlAttribute to set ATTR_TEXT_SELECTION_START to 0 (or any other position).
Stopping the text box update depends on how you're writing to it. Are you in a loop where you continue to append data? If you want to update the text box only after the loop is done, save the text in a variable during the loop. When the loop is done, use SetCtrlVal to write the varible to the control.
0 Kudos
Message 3 of 4
(3,579 Views)
Works Great, Thank You.
I felt stupid that I could not find the answer by myself, but after
an hour I finally gave up.
0 Kudos
Message 4 of 4
(3,564 Views)