Jump to content

Case Structures


i2dx

Recommended Posts

Hi,

i have a little problem with LV Scripting and i hope to find some help here.

The problem is: i am duplicating cases of a case structure with LV Scripting, but i have no idea, how to set the selector label.

Does anyone know, how this could work ?

thx,

cb

Link to comment
Hi,

i have a little problem with LV Scripting and i hope to find some help here.

The problem is: i am duplicating cases of a case structure with LV Scripting, but i have no idea, how to set the selector label.

Does anyone know, how this could work ?

thx,

cb

2500[/snapback]

My, you've been busy :)

I can't find this in the 'bag of tricks'. You can get a reference to a 'Case Selector', and it has properties and methods to get references to its subdiagrams, add/duplicate/delete cases, get/set the default case, and GETTING the array of selector strings, but I see nothing that allows one to set the selector values.

So, another one that probably has to 'wait for eight' .

Best regards,

Dave

Link to comment
  • 5 weeks later...
My, you've been busy  :)  

I can't find this in the 'bag of tricks'.  You can get a reference to a 'Case Selector', and it has properties and methods to get references to its subdiagrams, add/duplicate/delete cases, get/set the default case, and GETTING the array of selector strings, but I see nothing that allows one to set the selector values.

So, another one that probably has to 'wait for eight' .

Best regards,

Dave

2561[/snapback]

thanks for the labour anyway...

i was searching very long, but now i am convinced, that there is no way to do this. i tried to handle this problem by using enums and creating a new enum (using VI scripting) for the cases i need ...

best regards,

cb

Link to comment
  • 1 month later...
You can get a reference to a 'Case Selector', and it has properties and methods to get references to its subdiagrams, add/duplicate/delete cases, get/set the default case, and GETTING the array of selector strings, but I see nothing that allows one to set the selector values.

So, another one that probably has to 'wait for eight' .

Best regards,

Dave

2561[/snapback]

I don't see neither in properties nor in methods for it even how to "get/set the default case, and GETTING the array of selector strings". Can you tell us how to do that at least?

Link to comment
I don't see neither in properties nor in methods for it even how to "get/set the default case, and GETTING the array of selector strings". Can you tell us how to do that at least?

3635[/snapback]

See the attached VI.

If you are unable to create these nodes on your BD, you need to reread other posts in this forum on how to access scripting features.

Dave

Download File:post-195-1106468566.vi

Link to comment
See the attached VI.

If you are unable to create these nodes on your BD, you need to reread other posts in this forum on how to access scripting features.

Dave

3639[/snapback]

Thank you very much, David! Sorry, I thought I read this this entire thread. I also didn't realize, that even if you have a ref to a private class, say, CaseSelector. you can't expect that the property node will list all the properties if you just click on one of them. In this case if you have a property node for CaseSelector already, the list that pops up when clicking on a property doesn't show neither SelStrings, nor Default Case. That's apparently a second line of defense/hiding. I didn't think they would do that for private classes they thought we would not get our hands on anyways. Well, I was wrong. Thanks again.

Now watch what the next version of LabHSM will be able to do soon!

Stanislav Rumega

Link to comment
  • 4 weeks later...

One path forward might be that after a "Duplicate Case" operation the text cursor is on the case selector and has focus; Generating simulated keystrokes should make a new case!

This research fascinates me. I have a method of storing the Menu tags and need a method to verify that corresponding cases are missing or misspelled.

Link to comment
  • 1 year later...

I've been using LV for more than a week or two but I must confess I am having some diffculty getting my head around some new features.

The behaviour of the standard case structure has been compiler optimized to discard any code eliminated by a constant. Cool.

So now we also have conditional disable and diagram disable. With the changes in the case structure behaviour the differences are, to me. subtle.

Apart from the search function which allows me to find unique structures (and presumably delete them prior to a build), I don't have a solid understanding of where, when, or why I would use the two new features.

Anyone care to enlighten me? What am I missing?

Cheers,

Barrie

Link to comment
The behaviour of the standard case structure has been compiler optimized to discard any code eliminated by a constant. Cool.

So now we also have conditional disable and diagram disable. With the changes in the case structure behaviour the differences are, to me. subtle.

The "case structure" must have good wires in all of its frames. The "diagram disable" structure may have missing subVIs, broken wires, unwired required terminals and other broken bits in the disabled frames. The "code disable" structure is for multi-platform loading. "I want this to be enabled on Platform XYZ, and that to be enabled on Platform PDQ". This handles cases where you used to have a constant wired to the case structure for "Mac" that, when you loaded on a PC, you had to remember to go find all the instances of that constant and change them to "PC". It's also able to handle other configuration changes using the keywords that you define as part of the project environment. ("I'd like to build a debug version of my VIs, which has all this slow sanity checking code, and now, with just a change to the project, I'd like a release version which leaves out all the double-checking.")

Link to comment
The "code disable" structure is for multi-platform loading. "I want this to be enabled on Platform XYZ, and that to be enabled on Platform PDQ".

Just as a side note; if you use this strucure in a RT project, and you have a VI used on all targets but with different code (through a code disable structure) for Windows/RT/cRIO.

When you deploy to a target, you will probably have to save the VI again, since the target symbol has changed from previous run.

If you are running your VI from your SourceControl system directly, this means that you will have to check out/hijack the VI in order to be able to run it on all platforms.

Sometimes I wish that there was a way to tell LabVIEW to keep code for all targets...

/J

Link to comment
I have no idea. What does the documentation say?

Thanks anyway.

Documentation does not explicitly state that it is possible.

The reason I asked was that I got the impression that you were really familiar with the conditional disable structures (maybe even reponsible :) ), so I thought that perhaps you knew a way to get the available symbols.

/J

Link to comment
The "case structure" must have good wires in all of its frames. The "diagram disable" structure may have missing subVIs, broken wires, unwired required terminals and other broken bits in the disabled frames. The "code disable" structure is for multi-platform loading. "I want this to be enabled on Platform XYZ, and that to be enabled on Platform PDQ". This handles cases where you used to have a constant wired to the case structure for "Mac" that, when you loaded on a PC, you had to remember to go find all the instances of that constant and change them to "PC". It's also able to handle other configuration changes using the keywords that you define as part of the project environment. ("I'd like to build a debug version of my VIs, which has all this slow sanity checking code, and now, with just a change to the project, I'd like a release version which leaves out all the double-checking.")

Thanks Aristos and others:

This "leg-up" prompted me to dig deeper into these structures and I must confess that my original question was an RTFM. :oops: The differences are not as subtle or obscure as I first thought. Call it laziness or fear of the unknown.

I am using various versions of GPS receivers that are wildly different in their protocol (and data content :headbang: ) so selectively including drivers programatically will reduce the code size by quite a bit, but would lock me into a device-specific build.

One thing that is not explicitly stated (or I couldn't find); I am assuming that any code that is logically eliminated from executing is eliminated from a build, based on the target system and user defined symbols but this will only occur when the diagram is removed. I am futher assuming that this feature would not be appropriate for selecting features or functions at run-time in an .exe.

Is this correct?

In other words, are these features best used to control code size, execution speed or both? Any insight into the internal mechanics would be welcomed.

In the bigger picture, I don't think the full capabilities of the Project are appreciated without a lot of digging, but perhaps I am just futher exposing my laziness :) . Does one maintain one project and then manage the symbols and build specifications for platform or device specifics, or does one create a different project for each build? It seems to me that this question starts to merge into SCC issues and is perhaps outside the scope of a LV discussion. :blink:

Further (at the risk of rambling) how many of you out there are full adopters of the project paradigm?

- Do you always create a project, even when you are just trying out new ideas?

- Are you converting older projects to .lvproj?

- Does anyone use SCC in a single user environment for automatic archiving?

I am always trying to improve my software skills so all opinions and philosophies are welcome.

Cheers,

B.

Link to comment
Further how many of you out there are full adopters of the project paradigm?

- Do you always create a project, even when you are just trying out new ideas?

- Are you converting older projects to .lvproj?

- Does anyone use SCC in a single user environment for automatic archiving?

G'Day Barrie,

Looks like you're hijacking your won thread :D My suggestion is that you start new parallel threads asking those questions, rather than having this thread go off in all different directions - this makes it easier for people to search for topics in the future.

cheers,

crelf

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.