LabVIEW Idea Exchange

About LabVIEW Idea Exchange

Have a LabVIEW Idea?

  1. Browse by label or search in the LabVIEW Idea Exchange to see if your idea has previously been submitted. If your idea exists be sure to vote for the idea by giving it kudos to indicate your approval!
  2. If your idea has not been submitted click Post New Idea to submit a product idea to the LabVIEW Idea Exchange. Be sure to submit a separate post for each idea.
  3. Watch as the community gives your idea kudos and adds their input.
  4. As NI R&D considers the idea, they will change the idea status.
  5. Give kudos to other ideas that you would like to see in a future version of LabVIEW!
cancel
Showing results for 
Search instead for 
Did you mean: 

Comment Structure or Comment Box (surround a group of VIs with a box and comment)

Status: New

I sometimes wish to surround a group of VIs with a 'comment box' that explains that particular code section, for example to explain how the VIs interact with each other or why they were placed in a certain order.

 

To simulate this, I use Flat Sequence Structures, Flat Frames or Diagram Disable Structures with empty 'Disabled' cases (screenshot below).

 

Comment Structure 1.png

 

All methods are workarounds. It would be useful if there was a 'Comment Structure' or 'Comment Box' that was essentially a Flat Frame with an attached sub-label diagram.

  • The Comment Structure should be compiled-out and have no effect on the compiled code (unlike the Flat Sequence Structure)
  • The Comment Structure would not have any 'Disabled' cases behind it
  • The border of the Comment Structure should be as thin as possible. For example, the border of the Flat Frame seems too thick when I use that workaround.
  • I'd be happy if the Comment Structure consists of a single box and there was no option to 'Add Frame' like there is with the FSS, even though I sometimes use a multi-frame FSS to simulate back-to-back Comment Structures (like in the screenshot above).

A similar question was posted in the following thread: "Is there a way to put a comment box around a piece of code..." https://forums.ni.com/t5/LabVIEW/Comment-code/td-p/40568 

 

Thanks!

8 Comments
Proven Zealot

Another workaround is to get a raised frame from your front panel palette, and drop it (or copy paste it) on the block diagram.

 

The decoration won't have a diagram label, so it's just a workaround. But other then the label, I think it does what you describe. And it had been used for years.

Proven Zealot

> The Comment Structure should be compiled-out and have no

> effect on the compiled code (unlike the Flat Sequence Structure)

 

I proposed this part of your idea in 2009. In 2017, I had to decline my own idea after lots of feedback: https://forums.ni.com/t5/LabVIEW-Idea-Exchange/Both-disable-structures-should-have-less-effect-on-di...

The current standing decision is that no enclosing box* will ever be introduced to LabVIEW that does not follow dataflow semantics.

 

* I say "box" because it would not -- by definition -- be a "node" or "structure" since it would not behave with the single most important aspect of a node in G. We would have to introduce a whole new scripting hierarchy. See "Liskov Substitution Principle" for inheritance discussion.

 

You said:

> All methods are workarounds. 

 

The majority of users disagree with you, and, these days, so do I. If difference in compilation is off the table (see above), then there is no difference other than draw style between what you are asking for and the sequence structure, and draw style isn't worth the introduction of a whole new node.

 

With alternate compilation and alternate draw style off the table, I don't think there's anything left to this idea. You would need to propose a difference in run-time behavior to justify a new structure node... the edit-time behavior of disallowing adding frames falls under the heading of, "If you don't want to use that, don't use it." 🙂

Proven Zealot

If FP decorations had labels, this gest of this idea would be completed.

 

The decoration wouldn't actually contain anything, and it doesn't even grow if ctrl+drag and alt+ctrl+drag is used...

 

FP Decoration As Comment Structure.png

 

Knight of NI

I think all we would need for this is to have direct access to decorations on the block diagram.  So if we had a new decoration that was just a Flat Frame that had a text input associated with it, we have what the OP is looking for.  It isn't a structure, so it has nothing to do with data flow and sub-diagrams.  It is just a way to visually break up parts of your code.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Proven Zealot

Of course there will be other benefits if decorations had (hidable) labels.

 

make-decoration-labels-work\

give-decorations-a-label-property-to-address-and-modify-them

Proven Zealot

> It is just a way to visually break up parts of your code.

 

Therein lies the problem: it's a visual language. A visual way to break up parts of code gets interpreted by too many users as part of the code. Comment labels don't look like a functional node... a box does.

 

The community had this discussion often for the diagram disable structure. 🙂 And back then, I was on the other side. I've been worn down to accepting this as Truth. 🙂

 

> So if we had a new decoration that was just a Flat Frame that

> had a text input associated with it

 

A flat frame drawn on top can drift away from its contained code. If we start promoting frames on the diagram -- something few users even realize is possible -- we will immediately get requests for the frame to actually include the nodes... autosizing... moving with... until it has all the syntax behavior of a structure node. If it has the syntax behavior, it's going to need the semantic behavior. And now we're right back to "use a sequence structure".

Knight of NI

>A flat frame drawn on top can drift away from its contained code.

Yeah, and so can comments.  All I (can't say for certain the OP) am asking for is a documentation tool.  We all know documentation becomes stale unless actively updated.  Same goes for this decoration.

 

As another example, straight from the USB-845x I2C examples by NI, see this post: https://forums.ni.com/t5/LabVIEW/MCP23017-I2C-LabView-HELP-PLEASE/m-p/4072791#M1170486 


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Proven Zealot

> Yeah, and so can comments.

 

This is exactly why the attached comments were introduced. Attached comments remain attached.

 

> All I (can't say for certain the OP) am asking for is a documentation tool.

 

And all I'm saying is that the sequence structure meets every requirement for that documentation tool that has ever been given to R&D other than the "things inside should not run as a block", which, as explained above, is off the table for good reasons.