11-04-2014 07:21 AM
I have a piece of code which uses the VI Server method "ObjHighlight" based on actions on a tree control.
I have the slight problem, however, that when I try to highlight different items successively without user interaction then any previously highlighted object remains highlighted also and it looks like I'm shift-selecting items.
How do I limit the "ObjHighlight" method to only a single item programatically. I know that clicking on the FP the object is on will reset the highlight, but can this be done programatically?
11-04-2014 07:30 AM - edited 11-04-2014 07:30 AM
Shane,
can you attach an example? I dont seem be able to reproduce the issue...
Norbert
11-04-2014 07:39 AM
I would think that the selection mode property would be a good thing to try.
But I'm clearly confused. Doesn't ObjHighlight blink the entire tree object? or am I missing how you are using that method?
11-04-2014 08:02 AM
The tree inclusion is probably misleading.
My "Tree" is simply representing the internal hierarchy of a specific VI, Controls, Tabs and what not. I want the user to be able to double click on any given control there and highlight that object on the VI.
The tree itself is not being highlighted, it's simply controlling which other object should be highlighted.
It'll be hard to get an example without posting too much code because I'm parsing an entire hierarchy of VIs using come of my own tools and re-creating a VI server reference from a stored HEX value for the control which actually resides in a different project.
11-04-2014 08:16 AM - edited 11-04-2014 08:16 AM
Shane,
attached my approach in LV 2014. Is your approach comparable? If not, how does it differ?
Norbert
PS: Sorry for using a template VI, but still it is not possible to attach VI-files with my browser (Mozilla) 😞
11-04-2014 08:16 AM - edited 11-04-2014 08:17 AM
Of course trying to get a working demo leads to the problem not occurring.
It might be important that I'm accessing objects in this way across project boundaries. When the objects are in the same project at least, it seems to be no problem.
I need to dig deeper.
Shane.
PS Mine differs in that it's in LV 2012 (Can't open the attachment, sorry)
11-04-2014 08:22 AM - edited 11-04-2014 08:27 AM
That would be where I misunderstood.
Assuming: the object located and highlighted is on an idle vi. Undo Transaction "Should" unhighlight.
Catching back up-
I wonder if you are getting 1 highlighted object per context.
11-04-2014 08:38 AM - edited 11-04-2014 08:55 AM
OK, I managed to recreate the problem in a smaller VI.
I think it's important that the Controls are being highlighted in a different project than the code highlighting them.
Here's an example which opens references to ALL VIs in memory in ALL projects in memory (bear this in mind before running the code, I have ZERO clean-up code in there).
It then presents a ring with all "VI"s in memory. Selecting "Highlight" will step through all controls on the selected VI FP top-level and highlight them all with a 250ms wait between each one.
On my machine at least when it's finished, ALL controls are highlighted, not just one.
Edit: Sorry, I just added a different version of the file without our entire project hierarchy stored within the Ring..... Oops.
11-04-2014 09:16 AM
Ah, i see what you mean. It seems that it selected the controls (similar to CTRL+A). Is that what you are seeing?
One remark: It does not happen on VIs which are password-protected....
Norbert
11-04-2014 10:03 AM
Before you call the ObjHighlight method try getting the reference to the control's owning VI, get its FP reference and call the 'Clear Selection' method on the FP. This should leave you with only the last object selected. If you want no selecting then simply wire False to the Selected property of the control after you call the ObjHighlight method.