LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do i put text in a Listbox?sd

Hi,

For school we have to make a chatprogram with a datasocket in Labview.
We have placed a datasocketwrite (server) en a datasocketread (client).
De datasocket-write is connected as follow: First we have placed a string on the data-input.
De datasocket-read is connected af follow: We have placed as type and as data even a string too.
A while loop is created arround the datasocket-write and datasocketread. A SENDbutton is connected to run the while loop so the data in the string will be send when we hit the button.
The problem is that the send text will be disapeared when a new text is send. To solve this problem should the text everytime when the sendbutton is hit be saved in something like a listbox?
Does anyone now how we can fix this problem? Thanks in advance

Bert en Jeroen


0 Kudos
Message 1 of 9
(3,607 Views)

Hi,

You could have two displays.  A small one for the new messge being typed and being sent, and another to display the received messages as well as the sent messages.

The way to do the secong display is to append the strings as they are sent and received.  Place a Shift Register (right click the edge of the loop and select) in your while loop.  Initialize the shift register from outside the while loop (empty string or any string you want to start the display with).  Then wire the left shift register to an Append String (top) with the incoming text / outgoing text.  Wire the output of the Append String to the right shift register. 

When wiring the previous string to the top of the Append String and simply feeding new text,  it should prevent duplicating all the text for each iteration of the loop.   I wish I had LV at work, I could do a quick example.  A picture is worth 1000 words 😉 

JLV

Message 2 of 9
(3,600 Views)
Hi,

Thank you for your message!
We have build it up as follow see the picture >>>>>>: http://home.hccnet.nl/h.w.emmelkamp/labview.JPG
We still can't make it work. Can you give us for a second time a little help 🙂
Thanks in advance...


0 Kudos
Message 3 of 9
(3,586 Views)

Hi,

Excellent idea to post a jpg on your website.  You can also do attachments within this forum.

OK.. You're getting close.  What you need to do is wire an empty string " " outside (left) the loop to the Shift Register.  It will turn pink. The inside the loop, continue to wire from the left Shift Register to the top left of the "Append String.vi" which is located in the Strings tools.  Wire your existing "String3" to the bottom left (assuming 2 left boxes) of the "Append String".  The output of the "Append String" goes to the right Shift Register.  

If you want  to see the text while the loop is running, then place a string display between the "Append String" and the right Shift Register.  Placing a string display outside the while loop will show all of the strings only after exiting the loop.  For instance if you want to store the data in a file.

You can add more strings to be appended by selecting the Append String and dragging down.   Use Context Help for descriptions of the vi.  It is an essential tool (Under Help > Context Help).

Hope this helps,

JLV

Message 4 of 9
(3,577 Views)

Hi,

Although you already know this, I will mention it because it is an observation from your jpg image.  You cannot run the vi with unwired vi's.

😄

Message 5 of 9
(3,575 Views)
You haven't wired the shift register you have made a tunnel through the loop.  you need to attach the wire with the wiring tool to the shift register( when it is blinking).  Then it should work.  It would be easier for people to help you if you attached the vi's to messages in the browse function lower down on the reply web page.  Then someone could edit it for you and repost it...
0 Kudos
Message 6 of 9
(3,573 Views)
Ok

We now have placed the two vi's (compressed ZIP) in our post.
I hope you can make it work 🙂
Thanks Smiley WinkSmiley Wink

Bert en Jeroen
Students of the Hanzehogeschool Acedemy

0 Kudos
Message 7 of 9
(3,555 Views)
Here is an updated client / server application.  Don't forget to start the datasocket server prior to running the client and server vi's.  I added an event structure to only send the data when you press the 'ZEND' button.  The way you had it data was streaming from the client to the server continuosly.  That may have been your intention?  Have fun!
0 Kudos
Message 8 of 9
(3,545 Views)
Thank you very much!
The way you have make it work is excellent Smiley Wink
I'm very pleasered with this.

Regards,
Bert & Jeroen
0 Kudos
Message 9 of 9
(3,538 Views)