LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to do add a line to a text box, without using Concatenate vi ?

Hello, I would like a vi to acts as a logbook, where others vi can write any string with time and date. Under LabWindows/CVI, you just have to draw a Text Box, then to use the function InsertTextBoxLine. Under LabView, I made a while loop with a Shift Register and a concatenate string, but it is time consuming. The more lines there are, the more time it takes to write a new line, since in fact, the entire text box (in fact a huge string) is rewrited each time. So, this solution works very well at the beginning, but it becomes quickly very slow, as I can have thousands of lines. I would like someone to help me and tell me if there is an equivalent of InsertTextBoxLine, and how to add a new line very fastly since I have milliseconds timed operations. Need help please... Thank you
0 Kudos
Message 1 of 6
(4,412 Views)

You're right in principle the updating controls and indicators can be a heavy burden on LV, but why do you need a string with thousands of lines? I would expect that the users wouldn't be able to do anything with it anyway. If you want, you can easily hold the entire string in the wire (LV has no more problem with that than C does with variables) and only display part of the string.

I'm not sure how much a string with thousands of line cause delays, but it sounds reasonable that under certain conditions it will. Do you have a wait in the loop? If you don't, it will eat up all the CPU time.


___________________
Try to take over the world!
0 Kudos
Message 2 of 6
(4,407 Views)
What I need is a text zone (that I call 'logbook') to write events such as commands received from a remote controller, errors occured, user actions, and so on. My software can works 5 or 6 weeks without being interrupted, and the users should see all this events history on a display. With CVI, I used to use a Text Box with InsertTextBoxLine, that worked very well. But with LabView, I can't manage to get the same functionnality. Any idea ?
0 Kudos
Message 3 of 6
(4,404 Views)
You could use an array to display the strings. 

Have a large string control for which to enter whatever they want, then store that into the next element of the array, and have the array avaiable for viewing.  You can make the array indicator a lot more visually pleasing by editing the control and/or combining it with a slider as a scroll bar (I have done this to list errors in a test)...  Just keep the array in a shift register, and I think it should be less memory intensive.
0 Kudos
Message 4 of 6
(4,398 Views)
Basically what you want to do is createing a LabVIEW 2 style global with an uninitialized shift register. Create three methods clear, write and read and implement them such that in clear you clear the shift register to an empty string, in write you add the new string to the head or end of the existing string and truncate it to some maximum size and in read you get the entire string.

Create a wrapper around the write method which not only writes the new string to the previously mentioned LV2 style global but also appends that string to a file somewhere on your disk together with possible a timestamp at the beginning if that is not already part of your log string.

Call the clear method at the begin of your application somewhere, the Write wrapper whenever you want to post some message to the log subsystem and the read method in a separate loop in your main VI, putting the string information into a string control.

This is a fairly well working message log system but of course can be improved with occurrence in combination with wrappers around each method and an additional quit method. This would allow updating the string control in the read loop only when something changes.

Rolf Kalbermatter

Message Edited by rolfk on 08-12-2005 08:04 AM

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 5 of 6
(4,398 Views)
Instead of using a text box to hold all your entries, why not use a file.  No matter how big the file is, it is easy and quick to append to the end of a file.  At the beginning of your vi, open the file,  as your vi runs, you can write to the file, or you can read from the file and display the contents on your text box, or even just a part of the contents, like the last 10 lines or so.  Close your file at the end of your vi.  If you restart your vi, all of your info is still in the file.  Put in code to clear the file, or create a new one.
- tbob

Inventor of the WORM Global
0 Kudos
Message 6 of 6
(4,375 Views)