Jump to content

Textbox buffering


Recommended Posts

I have 2 major problems, I hope you guys could assist me on it

I'm working on a project reading data from a device

1)

I have no clue how to create a textbox with scroller where i could look back at previous information (information read from the buffer)

2)

i would like to clear the buffer whenever is full, i have no clue how to do it

i hope you guys could help me out on it

thanks

Link to comment

A textbox scrollbar is enabled using a string indicator and RMB>VisibleItems>Scrollbar. Note that the string indicator needs to be >2 lines in height for the Scrollbar option to be accessible.

Creating buffers is most easily done using a global variable. Place a string indicator in a global and read, append and write to the global with the arrival of each new set of data. [You could also use an array of strings if you want to store the data as messages]. The efficiency of this can be upped a little bit using a preallocated string array. Note that this method runs the risk of race conditions if you write to the global from multiple locations in your program. Instead I recommend a LV2 global, as discussed below.

Creating buffers is most efficiently done using a LV2 style global variable (aka functional global, aka shift register global; for an explaination see LV2 Globals). Create the string as either an single string, an array of strings or a preallocated array of strings stored in you rshift register. Add "method" calls to add or view your data. The link above provides a simple example.

One other alternative is to use a GOOP object to store your data.

cheers, Alex.

Link to comment

1)

regarding the textbox, i would like the messages to store in it, so i could use the scrollbar to look at the previous messages

is there any way of doing that ??

2)

my device sents out lots of information through a serial port, but my program seems to capture only a small portion of the entire data.

may i know how to overcome this problem and capture the entire problem ?

Link to comment
regarding the textbox, i would like the messages to store in it, so i could use the scrollbar to look at the previous messages

I thought Alex explained it quite nicely but just to clarify I've attached a dead simple method. I think the main idea is to read the previous data and concatinate the new data to the previous data using a end-of-line between the new and old data. Of course there are other logistics issues you have to take care of yourself but the framework should work as shown.

post-19-1088048641.png?width=400

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.