03-02-2016 01:46 AM
1. i managed to get the file names which are clicked. but how do i make all the clicked items to an array? I tried wiring it to a build array. but it does not seem to be working like i thought.
2. also cliking out of the list bound area before activating the search button, the vi was found to hang. what could be the reason.
3. on following stopping sequence where first the internal while loop and then the external was also hanging the vi. surprisingly stopping the outer loop first and then the inner seemed to work. what's the reason for this and what's the work around for the problem.
vi has been attached. please help
thanks in advance 🙂
Solved! Go to Solution.
03-02-2016 02:00 AM - edited 03-02-2016 02:03 AM
Hi Amith,
2. Wrong usage of the event structure. Did you read the LabVIEW help on them? Never hide event structures inside of case structures…
3. Same as 2. Why do you need two stop buttons at all?
Now on to 1:
- Never use tunnels set to "default if unwired" when you want to keep data! THINK DATAFLOW!
- Why do you use events of the pane? Why not use events of the listbox?
- Why not use the listbox terminal to read the selected element?
- Why don't you put the (inner) stop button terminal inside of the corresponding event?
Just a sketch:
03-02-2016 02:17 AM - edited 03-02-2016 02:20 AM
You do lots of things wrong. No surprise your VI hangs... First of all, you never set up an Event structure as you do! Just delete the outest while loop and case structure. You only need a single while loop, and an Event structure inside. Also delete the timeout case, you do not use it for anything! Why to timeout after 5 msec???
The mouse down mouse up events with coordinates are not really an option here...
Go to your Listbox on your Front Panel, right click on it, and select "Selection mode" --> "1 or more item" . In this way the user can select multiple files. By default, you can only select one single element from the list!
EDIT: i always write very slow my posts, GerdW was faster 🙂
EDIT2: what is below, is a snippet, save it, and drag&drop it onto an empty block diagram to get the VI...
03-02-2016 03:35 AM
Thank you so much GerdW. You showed me much more than what I wanted. Learned a lot.
Hmm, I'm still in the initial stages of understanding the correct data flow. I usually work things out by trial and error method or understanding how others have done and modifying it to my needs. Guess it's high time to start understanding data flow and build efficient vis
03-02-2016 03:44 AM - edited 03-02-2016 03:50 AM
Thank you so much Blokk. You did make a point about the timeout. I've still not quite understood the purpose of timeout in an event case structure. Will look that up right away.
I was not able to appreciate your vi completely, said could not load v15 on v13. but with the little what I understood from your code, it is more of a strict ordering. The strings are not recorded in the order i click, which is one of the important factor. I'm sorry for not mentioning that in the first place. It'd be nice if I could see ur code completely.
Thanks again 🙂
03-02-2016 04:18 AM - edited 03-02-2016 04:26 AM
It is very strange that you could not open the snippet. Must be something wrong with my LAVA Code Capture Tool, I set it to save into LV2013, it even shows version number 13.0 at the header...
Anyway, I modified the VI for you, and attach it as a proper VI too, not only a snippet. Now it simply records where you click, and incrementally builds up a string array. I also set the Listbox to only accept single selection in order to simplify to code (also set the data type to scalar from array; Selection mode: 1 item, Data type: scalar from the settings menu of the Listbox).
EDIT: so obviously this solution is the same what GerdW already showed you...
EDIT: actually his one is even better, since a double click more "user safe" compared to an accidental "mouse up" event in my example!
03-02-2016 05:49 AM
Thank you once again Blokk for spending time on this. This looks cool. 🙂 🙂 🙂 🙂
note: the snippet still showed the same error while loading.
Also, I wanted to add the feature of deletion from the new list incase of an accidental click, delete row option is there upon right clicking on the listbox in the front panel while the VI is not running. I went through all the property nodes, but din't find any. I googled and found row delete for multicolumn. Applied the same idea keeping in mind that mine is a single column. But I could not succeed.Any tips on that ?
03-02-2016 06:00 AM
@Blokk wrote:It is very strange that you could not open the snippet. Must be something wrong with my LAVA Code Capture Tool, I set it to save into LV2013, it even shows version number 13.0 at the header...
Looks like something's wrong on your end. I also can't open your snippet in 2013, but if I open it in 2015 and then create a snippet of the code for 2013, it does work and I can open it. My best guess would be that the save for previous method didn't work on your PC for some reason but did save something. Since the relevant code in the CCT doesn't do any error reporting, it's possible for such an error to go unnoticed. If you want to figure it out, I think you'll have to open the relevant VI, add a breakpoint and then run the CCT and see what happens inside it.
03-02-2016 06:36 AM
@amithkuttan wrote:Thank you once again Blokk for spending time on this. This looks cool. 🙂 🙂 🙂 🙂
note: the snippet still showed the same error while loading.
Also, I wanted to add the feature of deletion from the new list incase of an accidental click, delete row option is there upon right clicking on the listbox in the front panel while the VI is not running. I went through all the property nodes, but din't find any. I googled and found row delete for multicolumn. Applied the same idea keeping in mind that mine is a single column. But I could not succeed.Any tips on that ?
Well, in my example you fill the listbox with a list which corresponds to file names located in the specified folder. I guess you do not want to delete a line from the Listbox itself, but the last element from the propagated array indicator (to be more precise, delete an element from the shift register storing the incrementally growing string array). You can easily add an Event for a button which will delete the last line from this array. See below this new Event case (is this what you want?):