12-22-2011 02:42 PM
I'm interested in creating a string indicator that has a history to it, possibly with time stamps attached to it.
For those who have used AutoCAD it would be exactly like the command bar. A plus would be if I could only
save the last 100 entries to keep the size memory usage down.
Any thoughts? Does anyone have a code segment of this?
12-22-2011 02:52 PM
You store the data that goes into the string in a shift register. When you add more, you concatenate it to the end, send it to the string terminal and also to the shift register.
For keeping it from growing too long, you will need to keep track of its length and remove data from the front end.
One way to do this is if this is based on lines, use a 1-D array of strings as your shift register. Use concatenates strings on the array (or possibly array to spreadsheet string) to convert the array of strings into a single string to display. That way to remove data from the beginning, all you'd have to do is use array subset or Delete from array to remove entire lines at once.
12-22-2011 03:19 PM
You could also use a feedback node. You can modify the example to include timestamps, add linefeeds after each entry, and keep a number of lines rather than number of characters.
12-22-2011 03:56 PM
Thank you both for your suggestions. I have used parts of both.
Steve - How would you modify that to have a maxiumum number of lines? Especially because
my applications has lines of different character lengths.
12-22-2011 04:05 PM
Keep a line count and once you go over your limit search the string for the first new line and split it at that point.
12-22-2011 04:14 PM
Ravens fan already told you. But I know how hard it can be when you are new. This is what it looks like. And if I find out this is homework I'm telling your teacher on you
12-22-2011 04:16 PM
@Mark Yedinak wrote:
Keep a line count and once you go over your limit search the string for the first new line and split it at that point.
That is probably better
12-22-2011 04:44 PM
Don't sleep on the Queue to hold the strings, and a Listbox to display them:
Super crude autoscrolling added at last second.
12-22-2011 05:42 PM
Thank you all for your help. Once I became familier with the array functions I made a program that does exactly what I need.
12-22-2011 05:53 PM