LabVIEW APIs Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW Scripting Main Board

You can add the used enum's in you program to an indicator array of that enum. I would write a vi to do this and keep the array inside that vi, so you can easily add only the enums not yet present in your array.

read out that vi and you know which cases during that run were not used.

But are you sure they never will be used?

greetings from the Netherlands
0 Kudos
Message 121 of 171
(763 Views)

Ok, as to the first question, I thought what was being talked about was something different, so no problems there.

As to the 2nd...  I'm just at a point in creating a program where I have a lot of cases that are being used in a case structure and I know that I want to keep all of those. The problem is, I created a lot of "place holder" names in the Enum that I now want to get rid of.

I guess I could "create case for all values" and then go through and delete all of the empty cases from both the enum and the case structure (or don't worry about it - this is all driven programmatically). I can do it all manually, but...

0 Kudos
Message 122 of 171
(763 Views)

Unlike case structures, you can fairly easily change an enum programmatically.  Get all the case names from the case structure.  Open your enum typedef (if it is not a typedef, make it one) and use the Strings[] property to get its items.  Index through the Strings[] array, deleting any that are not in the case structure names array.  Write the strings back to the enum using the Strings[] property and save the enum.

0 Kudos
Message 123 of 171
(763 Views)

Here is the key bit of info that I have not yet figured out; "Get all the case names from the case structure."

- how do I get just the ones that are of the case structure itself? I can't use the enum (yes it is typedef'ed) itself because I get all the strings, I want just the cases that are used in the case structure.

The rest I can get np.

0 Kudos
Message 124 of 171
(763 Views)

Example_VI_BD.png

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 125 of 171
(763 Views)

Ok...  I got it:   My biggest problem isn't knowing what the method is, it's in going through all of the menues to find the target class that I need.  After looking at all of the classes two or three times, I finally noticed there was one called "Structures" and "Multiframe Structures" under Nodes....

AND now, I was going to load up the png of my code, but I can't get that to work!!!  It's a good thing it's Friday....

Thanks for putting up with me.

0 Kudos
Message 126 of 171
(763 Views)

Trying to change and select the label of the last placed FP Control - I can easily get the reference to the control on the FP by Traverse for Control, getting the reference.  I can read the label, but changing the label.text to write does not change the text of the selected object on my target VI - is this not supported in LabVIEW?

Alternately I would like to implement the function of selecting the label text like LabVIEW does natively when you first drop a control - I have tried label.selection with many combinations of values and nothing seems to work.  I also tried setting the key focus = true on the control.  I am not getting any errors from any of my code.

LabVIEW 2011, Windows XP

Ryan Vallieu CLA, CLED
Senior Systems Analyst II
NASA Ames Research Center
0 Kudos
Message 127 of 171
(763 Views)

Label.Text property works even in LV2009. Please make sure the VI in which you are trying to change the label is in Idle operation mode. If you provide the code it would be easier to check for problems and find solution.

0 Kudos
Message 128 of 171
(763 Views)

The VI is idle - just sitting there not running. 

Scripting labels.png

The Label.text read works no problem.  I have tried my other scripting code with the reference and I can count terminals, move labels on the BD, etc. but label.text is not updating with new text, nor is the label on the FP being selected.

Adding read of VIProperty Exec.State shows the state for the target VI is "Idle"

Adding a Save Instrument did force the update of the control label, but that is not ideal at all.

in this instance I am doing the Open VI Ref with option set to Hex 1 like in some of the Example Finder code - in my real app I am getting the VI ref from Active Application firing - still get the same results, label read works, update does not, all other of my scripting code to move things, etc. works.

EDIT: 2:25 PM EST - when I throw in a FP.open after opening the VI ref the changing of the label text works, but the label selection of the last dropped control is still not selecting/highlighting the label text for immediate editing by the user.

Ryan Vallieu CLA, CLED
Senior Systems Analyst II
NASA Ames Research Center
0 Kudos
Message 129 of 171
(763 Views)

From the LabVIEW Help for Label.Selection: 

Text selection specified in terms of character positions for the beginning and end of selection (both inclusive). If you set the start and end to be the same, LabVIEW inserts a caret into the text.

If you want to highlight the text, you must set key focus on a control before you use the Selection property.

The Bold might be the problem - I have set the Key Focus = True, but when I check after with a KeyFocus read it reads as FALSE.  Strange since Remote Access is allowed for the Key Focus property.  I am perplexed.

Adding is FrontPanelWindow.IsFrontMost? and setting it to TRUE for the VI is also not working to allow me to set the KeyFocus = True.

There has to be a method that NI is using that allows selection of the Label Text as when you drop a new control - I really want to get that to work!

Ryan Vallieu CLA, CLED
Senior Systems Analyst II
NASA Ames Research Center
0 Kudos
Message 130 of 171
(763 Views)