10-02-2008 03:12 AM
I am using the testing vi attached.
How to know if one item in the tree is highlighted or all the items has not been highlighted.
Thanks.(In default the selected item will display the first item)
10-03-2008 06:18 AM
Hello... 🙂 Can you please explain in detail what exactly you want to do...?
If possible please attach a screen print of your VI... 🙂
10-03-2008 09:31 AM - edited 10-03-2008 09:32 AM
You seem to be using the ActiveX TreeView control, so your question is really more for that control rather than a LabVIEW question. In this kind of situation MSDN is your best source of information since it's a Microsoft control. In your case I can think of one way to do it: Your callback VI provides you the reference to the control. Thus, you can use the properties and methods for the control to see what's selected. For instance, you can get the list of nodes using the Nodes property, get the count, and then go through each node to see if it's selected. Something like this:
Note: Add error handling as needed.
Side-note: Your VI seems to be accessing subVIs that are part of the examples. If you're going to use them you should copy those subVIs to your own directory. This will lessen the chance of the code breaking if the examples are changed with the next version of LabVIEW.
10-05-2008 09:47 PM
Hi turbot,
smercurio's vi is a very good one that shows you how to find the number of selected items. Give it a try.
Anything that is associated to third party software/items/controls through ActiveX is not from NI. How do we use them in LabVIEW will depends on what properties the developer of the software expose to let other software like LabVIEW to access it. So smercurio's suggestion of referring to MDSN is good so that you will know more on what properties are exposed for you to use it in LabVIEW.
Lee
Applications Engineer
NI ASEAN (SG)
10-06-2008 01:37 AM
Hi smercurio_fc
I tried to modified as the attached vi.
1) Am I using the right reference.
2) It always generate 2 errors in the loop as clear by the error clearup.
3) It is not exactly can detect every click by LED. If I click on 'Central', no LED is on.
4) Actually it is an example from LV, I am not sure how it works. May you give a brief introduction.
Thanks.
10-06-2008 05:44 AM - edited 10-06-2008 05:44 AM
Hi turbot,
You need to add an increment at the index node as shown in the picture attached below. This is because the index of this Tree View starts from 1. If you add the increment, you will not encounter any error. Hence, you can remove the 'Clear Error.vi'.
If this does not resolve your error/problem, can you provide me with the followings??
- There are missing VIs in your vi. Can you attached TreeControl.llb?? This library is located in 'C:\Program Files\CM CLIENT\SubVI' folder.
- You also mentioned that it generates 2 errors. What are the 2 errors that it generates?? Can you provide me with the printscreens of the 2 errors generated??
- You also mentioned that this is an example from LV. May I know where you find this example from?? NI Example Finder or NI DeveloperZone?? The link??
Thank you & Regards
Lee
Applications Engineer
National Instruments ASEAN
10-06-2008 08:52 AM
You also seem to be mixing and matching operations. The code I showed you was supposed to go into the callback VI, not the main VI, as my understanding was that you wanted to get an update whenever the user clicked on the tree control. As it is, you have the code in the main VI, so what is the callback VI doing now? Where you put it depends on how you want the program to operate, but if it's going into the main program, then I see no need in having a callback VI in this case.
There is also no point in unbundling the output of the "Generate Tree" VI to get the control reference. You have it right there on the diagram - it's the control terminal. Besides, you're further unbundling that to get the Nodes, when you already have it as one of the elements of the cluster that you unbundled (which you don't need to in the first place).
10-06-2008 09:51 PM
>You also seem to be mixing and matching operations. The code I showed you was supposed to go into the callback VI, not the main VI, May I know which one is the call back vi.
>as my understanding was that you wanted to get an update whenever the user clicked on the tree control. As it is, you have the code in the main VI, so what is the callback VI doing now? What need to do is when someone click on one item in the tree and click another 'add' button, the highlighted item will be add into another list. Incase he click the 'add' button without highlight any items in the tree, I need to give a waarning.
|
10-06-2008 09:55 PM
Hi Lee.P,
It can report the latest highlighted item in the history, but if he has not highlight a item any more, it seems still will give the latest result in the history, any suggestion?
10-07-2008 01:39 AM
Hi turbot,
I am afraid that is the characteristic of the Tree View. I did not manage to figure that out. Maybe you want to refer to MSDN to find out more about this Tree View.
However, I do not think this matters to your application since you have a OK button to ensure that the user really want to add in the selected item in the Tree View.
Regards
Lee
Applications Engineer
National Instruments ASEAN