TonyKuiper Posted May 28, 2005 Report Share Posted May 28, 2005 Hello all, This is my first post ever, so "Hello, World!" Basically, I'm trying to discover the method of using VI Scripting to create Front Panel and Block Diagram comments. I know, I know, who ever wants to comment their code? I, for one, think that <CAN_OF_WORMS LID="OPEN">even though LabVIEW is a self-documenting language, there are still many times that comments are helpful and even necessary.</CAN_OF_WORMS> That being said, I've plowed through the many possibilities that the 'New VI Object' node allows and have found two Nodes that act as comments for a Front Panel, but as for the Block Diagram, nothing. Code is attached demonstrating FP Comments, 'Scripted VI Comments.vi'. My question is this, gurus: does anybody know how to create what the Diagram object calls 'Decos'? (I'm guessing this is short for 'Decorations', and I'm not referring to the type of Dialog Decorations placed on the front panel, either!) I've attached another quickie research VI I scabbed together - 'Export VI Contents.vi' that profiles the top-level contents of a VI. (It doesn't go through everything in the VI, such as Case Structures, Sequences, etc...) Run this VI on itself and you'll see what I'm talking about - on my machine the last object reported is a 'Deco'... Thanks for your time, Tony Download File:post-2230-1117250735.vi Download File:post-2230-1117250751.vi Quote Link to comment
Jim Kring Posted May 28, 2005 Report Share Posted May 28, 2005 This LabVIEW Object is called a "Label". If it is owned by a VI's FP or a Diagram object, then it is a "floating" Label (by convention). Here is some example code showing how to drop one on a VI using the "New VI Object" function. Hmmm, you don't have that in your palette? Download Commander and get it. Download File:post-17-1117261434.zip Quote Link to comment
TonyKuiper Posted May 30, 2005 Author Report Share Posted May 30, 2005 Jim, I don't know if I hadn't made myself clear, but I had already found this Object type and one other - 'Dialog Label'. (check the 'Scripted VI Comments' VI attached to my first message.) The problem I have with these two Object types is that they both exist/are created on the Front Panel, not the Block Diagram. I checked the 'Is On BD?' property for both of these Object Types, but it's read-only and cannot be used to force the newly created Label/Dialog Label onto the Block Diagram. Just out of curiosity, what other conventions are there for labels? (Since "floating" was a new one to me!) Thanks again, Tony P.S. I already have the 'Additional Application Control' pallete from Commander, it's how I wrote my example code. My compliments to the creator(s)! P.P.S. Please forgive the lack of Close References in the original example - that's what I get for not double-checking my work before submitting! This LabVIEW Object is called a "Label". If it is owned by a VI's FP or a Diagram object, then it is a "floating" Label (by convention). Here is some example code showing how to drop one on a VI using the "New VI Object" function. Hmmm, you don't have that in your palette? Download Commander and get it. 4880[/snapback] Quote Link to comment
Jim Kring Posted May 30, 2005 Report Share Posted May 30, 2005 Jim,I don't know if I hadn't made myself clear, but I had already found this Object type and one other - 'Dialog Label'. (check the 'Scripted VI Comments' VI attached to my first message.) The problem I have with these two Object types is that they both exist/are created on the Front Panel, not the Block Diagram. I checked the 'Is On BD?' property for both of these Object Types, but it's read-only and cannot be used to force the newly created Label/Dialog Label onto the Block Diagram. Just out of curiosity, what other conventions are there for labels? (Since "floating" was a new one to me!) Thanks again, Tony P.S. I already have the 'Additional Application Control' pallete from Commander, it's how I wrote my example code. My compliments to the creator(s)! P.P.S. Please forgive the lack of Close References in the original example - that's what I get for not double-checking my work before submitting! 4883[/snapback] In order to create a floating label on the block diagram (or a structure's diagram), you need to use the diagram reference as the owning object argument in the "New VI Object" function call. See the attached example and screenshot. Note: if you are trying to place/edit comments inside of structures, such as Case Structures, or While Loops, you will need to traverse the BD object hierarchy, in order to obtain the reference to that object's diagram. This is similar to traversing Tab Controls and Clusters (by control reference) on the FP. Good luck. Download File:post-17-1117426951.zip Quote Link to comment
martin@aerodynamics Posted May 30, 2005 Report Share Posted May 30, 2005 Hello Tony, With this option (Have a look at the jpeg) you can also create invisible, (unerasable) Labels. You can delete those (invisible) labels only by scripting, if they are directly on the diagram... It is also possible to read from and write etc. to the Labels. Martin Quote Link to comment
TonyKuiper Posted May 30, 2005 Author Report Share Posted May 30, 2005 Jim, Well, I'm slapping myself on the head. This one should have been obvious. Thanks for your help! Tony In order to create a floating label on the block diagram (or a structure's diagram), you need to use the diagram reference as the owning object argument in the "New VI Object" function call. See the attached example and screenshot. Note: if you are trying to place/edit comments inside of structures, such as Case Structures, or While Loops, you will need to traverse the BD object hierarchy, in order to obtain the reference to that object's diagram. This is similar to traversing Tab Controls and Clusters (by control reference) on the FP.Good luck. 4884[/snapback] Quote Link to comment
Jim Kring Posted May 30, 2005 Report Share Posted May 30, 2005 Jim, Well, I'm slapping myself on the head. This one should have been obvious. Thanks for your help! Tony 4891[/snapback] Cheers, Quote Link to comment
Rolf Kalbermatter Posted May 31, 2005 Report Share Posted May 31, 2005 Hello Tony,With this option (Have a look at the jpeg) you can also create invisible, (unerasable) Labels. You can delete those (invisible) labels only by scripting, if they are directly on the diagram... It is also possible to read from and write etc. to the Labels. Martin 4888[/snapback] Each!!! They localized the scripting too! Rolf Kalbermatter Quote Link to comment
Jim Kring Posted May 31, 2005 Report Share Posted May 31, 2005 Each!!! They localized the scripting too!Rolf Kalbermatter 4897[/snapback] Or maybe Martin used the INI key: superPrivateScriptingFeatureSichtbar=True :laugh: Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.