LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Objects on Tab Control Pages

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

0 Kudos
Message 1 of 7
(5,024 Views)
If the only decoration you are manipulating is a free label to give directions, then the best bet would be to use a string indicator that you can customize to paint borders and backgrounds transparent.  If it involves other decorations, I'm not sure what you could do with them.
0 Kudos
Message 2 of 7
(5,018 Views)

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.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 3 of 7
(5,013 Views)
It should also be mentioned that you do not need to put the decoration inside the tab control (although I agree that a string indicator will probably be easier to deal with). If you use the mouse to move the decoration over the tab control then LabVIEW will place it inside the tab control. If, however, you use the arrow keys to move the decoration then you can have it "float" over the tab control and not actually be contained within it.
0 Kudos
Message 4 of 7
(5,009 Views)

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:

  1. You don't need to go through the hierarchy to get a reference to the tab control. Like any other control, you can just right click and create a property node for the Pages[] property.
  2. If you want to identify a specific decoration, you can give it a label tag. In 8.6, this is exposed through VIs found in <vi.lib>\UserTags. In previous versions, it's private functionality. If you do this (although I would advise against it), be sure to give the tag a unique name, as there is no repository for managing these tags.

___________________
Try to take over the world!
0 Kudos
Message 5 of 7
(4,988 Views)

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.  😛

Message Edited by Darren on 03-29-2009 10:42 AM
Message 6 of 7
(4,968 Views)

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

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 7 of 7
(4,942 Views)