LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
ErnieH

Collapsible code

Status: Declined

Any idea that has received less than 9 kudos within 9 years after posting will be automatically declined.

I would like to be able to collapse code so that it looks like a sub vi but is part of the main vi as if it was not represented as a icon. Double click to edit it like a vi. Options to convert it to a real vi. This would be useful for glue logic, being able to build and share more complex functions without a lot of subvi's. Decrease cross linking of VI's and naming problems. Attibute nodes and locals could be used inside ot them without passing a reference. Would make source code control simpler.

8 Comments
altenbach
Knight of NI

In terms of compiled code, we now can inline subVIs in LabVIEW 2010.

 

If I understand your idea right, I think it would promote non-modular monster toplevel Vis with all code crammed into one diagram. This should not be encouraged. 😉

crossrulz
Knight of NI

First of all, hiding code is bad.  Secondly, I would much prefer having a subVI that I could possibly reuse (goes along with the modularity comment altenback made).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
JackDunaway
Trusted Enthusiast

Hiding code is not always bad. If it were always bad, then SubVI's would be bad.

 

We have discussed this feature before, and I'm still ambivalent. There are benefits to what you're suggesting, but it's a feature that opens up a new level of potential syntax/documentation abuse. Here are the related ideas/discussions:

 

http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Macro-in-LabVIEW/idc-p/1095795#M4865

http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Ability-to-embed-VI-s-and-type-definitions-into-other-...

ErnieH
Active Participant

If I have a function that has 10 subvi's in it vs a function that have the VI's embedded in it, what's the difference? Is the code any more hidden than using subvi's? The function as it stands would then represent a complete idea without any subvi's. It would be easier to move from project to project. You would not have to worry about naming conflicts of vi's when you move it. How many subvi's do you create that only support the upper level vi? Do you need a subvi for those? I am not saying you cannot or should not create subvi's, I would like to be able to keep it all in one file if the subvi's are not reusable or I want to create a reusable function. If anything, I think it would make it easier to create modular code, as you could create more complete vi's that are much easier to move between projects. If you are concerned about abuse, you could have a 'save as' function to save it all as subvi's. Then there is no difference.

tst
Knight of NI Knight of NI
Knight of NI

Like I said in the other thread, 2010 has the packed project library which should cover at least some of what you want. It will probably not satisfy you, since it seems to be more a distribution feature than a development feature, but it might be enough for you.


___________________
Try to take over the world!
ErnieH
Active Participant

One last comment on this. If I have a function that has several subvi's, I would like to save them as one file. I included a screen shot of part of a program. The sub vi is only used in this vi. I can put the code in each state. That way if I edit it, it changes in all the cases. Yes I can create a library, and maybe the packed project library may help. I still want the functionality of a sub vi, but with a reduction of the number of files created. I could then pass this Vi to another user or another project without any cross linking problems, missing files, etc. In my mind, just a simpler way to keep my code together. It seems like a lot of people agree, since the Kudos counter has already rolled over back to zero!21137iA830EB9B05F5E932

jeffreyvalecruz
Member

Yes! We need this!  - You said what I was thinking, but I created a new post before finding yours - kudos from me.

 

See my post here: Collapse code instead of creating subVI

 

 

Darren
Proven Zealot
Status changed to: Declined

Any idea that has received less than 9 kudos within 9 years after posting will be automatically declined.