LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Listbox Stops populating

I have a VI that
 
1. Reads a text file and sends the two colums of data to a multi colum list box
2. Assigns custom symbols to the item rows based on the value of the element in colum 2
3. Allows the user to select items and pass the selected items to a second listbox, and deletes the selected value from the first listbox
 
This VI has the following quirky behavior
1. Works correct 50% of the time
2.  No data items show up in the second listbox until the seventh item is sent (no clue why), items do delete from LB1
3.  No data is sent no matter how many times data is pass from listbox 1. , Items do delete from LB1
 
I placed an indicator on the data line going into LB2 and the data is being passed to LB2
I replaced the LB2 and the app will work for a little while then it reverts back to the random mode of operation.
 
Any help would be appreciated
1:30 Seconds ARRRGHHH!!!! I want my popcorn NOW! Isn't there anything faster than a microwave!
Message 1 of 5
(2,435 Views)
11 worked when posted
 
12 was failing when it was posted
 
 
1:30 Seconds ARRRGHHH!!!! I want my popcorn NOW! Isn't there anything faster than a microwave!
0 Kudos
Message 2 of 5
(2,432 Views)
Tim,

Put a TopLeft property node for Listbox_2 outside the while loop and wire 0,0 to the inputs. I think what was happening was that the scroll bar was scrolled down to the bottoom of the listbox and the new elements were too high to see. Try making the scroll bar visible from the front panel and disable the internal scrollbar control after running the thing once or twice to generate the "disappearing problem. The data will be there but hidden.

Also you could have race condition problems. Many parts of your program have no data dependency, which means that they could execute in any order. The while loop could execute before all the initialization nodes at the left execute. (It would probably only loop once before the others executed but dataflow does not assure this.) Similarly the empty array written to Listbox_1:Value inside the event structure might occur before or after the terminal is read. Use the error clusters to enforce dataflow or move the function to another part of the diagram to assure that what you want actually happens.

You repeat identical code to process ItemNames to ItemSyms several times. This is a good place to make a subVI. I think a single Index array will do what you are using Delete from Array plus Index array to do.

The Event structure timeout and Wait for Next ms Multiple are redundant. Since you are doing very little in the loop outside the Event structure and nothing in the Timeout case, you could probably set the timeout to -1 (never timeout) and add cases for Send All, Stop, and Listbox_1 DoubleClick.

Lynn
Message 3 of 5
(2,420 Views)

Thanks Lynn

 

You were on target with all the feedback.  I kinda slap the code down until it resembles a working model and then go back and straighten it up.  I have been trying to figure out a way to lay my code out more like a PC board schematic.

 

Is it possible to have a group of code  pass all the outputs out via a cluster then feed a local variable and use a copy of that same local varible to feed another group of code?  I'm trying to avoid crossing data paths.  Not sure if cluster is exactly what I am looking for...

I need a way to group all the outputs and inputs to a group without a cluster showing up on the front panel..

 

Thanks

Tim C.

1:30 Seconds ARRRGHHH!!!! I want my popcorn NOW! Isn't there anything faster than a microwave!
0 Kudos
Message 4 of 5
(2,410 Views)
Tim,

You can certainly make clusters which do not have a front panel control or indicator. Use the Bundle and Unbundle nodes from the cluster palette. You cannot use the By Name versions unless you have a control or indicator with named components in the cluster (the names are linked to the control/indicator).

Wires are always a better choice than local variables for passing data. It maintains dataflow and avoids race conditions and extra copies of the data. Use a shift register if the data needs to pass from one iteration of a loop to the next. If the data must pass between parallel loops, queues or functional global VIs are better choices.

Some crossing of wires is probably inevitable in a complex program. Use of subVIs and careful planning can minimize the amount of spaghetti code you generate. Putting the wires which go everywhere near the bottom or top of the screen and the subVIs and function nodes near the center can help. In some of my programs I have a large cluster of "Flags and Indicators" which passes data around. I make a typedef of the indicator so that changes are easily propagated thoughout the program. The error cluster and the state enum are kept separate, but are also wired across the bottom of the loop.

Lynn
0 Kudos
Message 5 of 5
(2,382 Views)