|
Post by Antoine on Jun 9, 2014 10:00:42 GMT
Hi, I thought this would be straight-forward but I can find the right way to do it... I have a sequence tree xcontrol with a sequence loaded in it, and on the FP, next to the tree xcontrol I'd like to put a "remove selected test" button, how can I get the gID of the selected state to then remove it? The reason why I want a button to remove (and no right-clic) is that I'm planing to deploy on a touch screen. See attached VI rmv test.vi (15.74 KB) Thanks for your help
|
|
|
Post by Thoric on Jun 9, 2014 23:28:46 GMT
Hi Antoine, A very interesting idea, using the tree XControl in a touch panel application. This first release of the tree view XControl only allows for mouse based interaction, and that's largely through the right click menu. If you want to programmatically perform the edit then you need to call the "extract test by gID" function, which of course needs to know the gID of the selected item(s) to be removed.
Because the XControl doesn't return information on the selected items you can't use it with the "extract test by gID" function, unless you can somehow extract the 'selected items' information from the tree view.
If your tree view requirements are quite simple, which perhaps they are if you're not interested in the right click menu, then consider creating your own tree view. Use the "Populate Tree" function for populating your tree, and you'll find the Values of each element are actually the gIDs in string form. This will allow you to gather the gIDs of the selected items and use them in your own way, with functions such as "extract test by gID" for example.
If you also want to take advantage of the highlight execution, then perhaps consider two tree views. One being your own, for editing the sequence, and the second being a PTP Sequencer tree view for displaying execution with highlighting. You can switch the visibility of each as and when you need to see them.
I hope that helps? In the meantime, I'm going to add to the future features list suggestions for additional functionality within the tree XControl to enable programmatic interaction.
|
|
|
Post by Antoine on Jun 10, 2014 6:30:58 GMT
Thanks for your answer ; after having a close look at the tree XControl I was expecting such an answer. Now to make this easier, would you consider unlocking the tree XControl so that I can simply add a property "selected item" that I could read at any time?
Cheers
|
|
|
Post by Thoric on Jun 10, 2014 10:10:31 GMT
I can't open up the XControl I'm afraid, but I will put the idea to the team for consideration for a future release. In the mean time, because I'd like to help if I can, I've quickly knocked up a new tree XControl that includes an additional property "selected items" which returns an array of gIDs for the selected item(s). It's experimental, unsupported, and comes with no guarantee, but you are welcome to try it out. Warning! Use of this XControl will cause all existing instances of the tree XControl throughout all your VIs to lose their saved state data. This means highlight execution, right-click menus, visibility of scroll bars etc. will all default to off. Therefore you will need to reapply the settings for each by right-clicking the tree XControl and selecting Properties and reapplying your configuration of choice. Similarly, the Examples will lose their preferences and need restoring before they will work.To use this XControl, close LabVIEW and backup all the files in folder <LabVIEW>/vi.lib/PTP/ptp_sequencer/ptp_sequencer_xctrls/ptp_sequencer_treeXC/ to a recoverable location (such as a backup sub-folder), then unzip the files in the attached zip file here.
Launch LabVIEW and double check the new XControl property exists by opening the Drag and Drop example, go to the block diagram, right click the Tree XControl terminal and select Create > Property Node > Selected Items [gIDs]Let me know how you get on!
|
|
|
Post by Antoine on Jun 10, 2014 10:38:39 GMT
Great! Thanks for doing this so quickly! I'll try it and let you know.
|
|
|
Post by Antoine on Jun 10, 2014 11:31:13 GMT
SWEET, works just like I need! Many thanks
|
|
|
Post by ptpuser on Jul 7, 2014 13:36:54 GMT
Regarding the absence of a mouse and no right-click: on Windows machines you can press Shift-F10 to access the right click menu. Hope that helps.
|
|
paulh
New Member
Posts: 1
|
Post by paulh on Mar 4, 2016 16:05:58 GMT
Firstly, I'll add another note of thanks for the new feature I'd like to take another step, and allow editing of my (object) test items. So far as I can tell this isn't strictly possible with the functions exposed at the moment. If this is not the case, then feel free to correct me! I can use the new XControl Property to get the selected item, but if I extract the test to edit it, then I don't know where it comes from to replace it correctly.* If there were an additional return from the 'Extract sequence' VI then I guess I could reinsert my edited test back into the correct place? Or perhaps there is a better way? Thanks, Paul * I knocked up a quick hack that uses the Flattened Sequence details to work this out, but obviously this breaks (with an attempted recursive call, as it happens) if one includes a loop! I'll post it here if you like - it's just a tweak of the drag and drop example code.
|
|
dbarr
New Member
Posts: 1
|
Post by dbarr on Mar 8, 2016 8:34:13 GMT
Hi Paulh
From memory I tried to do a similar task about a year ago. I believe I have I went about the same way you did (using flattened Sequence details) and came across the same limitations. I will try and dig out the code today or this evening.
Cheers Dave B
|
|