03-27-2009 10:37 AM
I have an application where I want to "locate" a Decoration on the Front Panel (it is a label that I'll use to present instructions to the user by manipulating its properties). I locate this object by walking down a "property node" chain, from This VI to Decorations, then (in a For loop) selecting the "Text" decoration (I can skip this step since there's only one decoration). In particular, when my program starts, I locate all of the objects on the Front Panel and make them "invisible", except for the "Text" decoration. Now, by manipulating its properties, including the text displayed, I can provide a clean way to present messages without requiring user input.
My Front Panel, however, is now pretty busy, and I want to clean it up for my user. I thought to use a Tab Control, putting things I want the user to "see" during the running of the program (like the Message) on Page 1, and putting all of the other stuff (much of which is used to "initialize" or "specialize" the running of the program, hence is set either before starting the program or as the first step in execution) on other tabs. Now, however, getting acces to the Decoration (on the first page of the Tab Control) is much more involved. Although it "seems" to be visible on the Front Panel, it really isn't (because it is on the Tab Control). So the sequence becomes as follows: This VI -> Panel -> Controls[] -> (in For loop) select Tab Control ->(in Case statement) Pages [] -> (in For loop) Objects on Page -> select Text decoration (and process in Case statement). Thus I've gone from one For loop to find the object of my desire" to three nested For loops (with additional Case statements in the nesting scheme)!
Oh, well. The gain in clarity for the user probably justifies this additional complexity of the code (which will, after all, be "hidden" in a subVI or two).
Any other ideas on how to accomplish the goal of a "simpler" front panel? The Tab Control seems like a very versatile way of doing this, despite the pain of handling all of the nested loops.
Bob Schor
03-27-2009 11:03 AM
03-27-2009 11:21 AM
I'm with RavensFan here: If you want access to this particular item, then make it an indicator, paint the border and background transparent if you like (I do that all the time), and pass a reference to it from the main VI down to wherever you need to diddle it.
If you set its default text, then you can hide / show it as needed.
Or you can set its text to < message > or to blank, as needed.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
03-27-2009 11:32 AM
03-28-2009 12:51 PM
I agree with the previous suggestion (use a string indicator, which you can even update conveniently in a subVI by passing a reference), but have two additional points:
03-29-2009 10:42 AM - edited 03-29-2009 10:42 AM
tst's suggestion for identifying the decoration with a tag is a good one. I was going to suggest this, along with using the TRef Traverse for References.vi found in vi.lib\utility\traverseref.llb. I'm pretty sure this LLB is present in LabVIEW 8.0 and later. With this VI, you can simply traverse the front panel for items of the "Text" class, then iterate over the results to see which one matches the tag you set. Traversing automatically looks inside nested objects, so you can avoid the task of having to go look "inside" the tab control.
All that being said, if I were writing an app like this, I probably would have started off using a transparent string indicator. 😛
03-30-2009 05:57 AM
I needed to get the image of a decoration but decorations do not have a get image method.
Dropped the decoratin in an invisable cluster and then I could use the Get Image of the cluster.
Take home message:
Use transparent cluster as a container for the decoration.
Just other idea to add to the bag of tricks,
Ben