LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Tab Control, LabView 7, Unions, etc

Hi,
Would someone who has an installed copy of LabView 7 be kind enough to answer some questions about what ways (if any) the TabControl differs from Labview 6.1 (which is what I have).

In LabView 6.1 you could not put tab controls inside of arrays or clusters on the front panel. Can you do this in LabView 7? Also, there have been discussions of treating the tab control as a cluster - has anything become of this?

Here's why I'm asking: In my application I have need for a Union data type (ala C). Since LabView does not support unions I am simply using a cluster for the union (and an enum to tell which subitem is being used). As you would expect having a cluster with a half-dozen large subclusters in it takes up a fair amount o
f real estate on the front panel. Therefore, it would be really nice to place all my sub-clusters into a tab control. In addition to saving space, this would actually provide a much more fitting visual representation of the union.

Having a good visual representation is important because the user needs to be able to edit this data type (it is test definition - akin to a sequence in TestStand). One of the cool things about LabView is that once you define a data structure, you get a GUI widget for free. But in this case in order to provide a nice interface to the user, I will have to write code to sync the controls on the user interface the internal data structure. This looks like a fair amount of work - and even in the simple proof-of-concept I have coded up I am having problems with event race conditions.
0 Kudos
Message 1 of 6
(3,373 Views)
I just tried this in LabVIEW 7.0 and you can not place a tab control in a cluster or array. I'm not very clear on what you are building, but I've been trying to come upu with another option for you. Instead of the "super cluster" with subclusters, could you just use a tab control with a subcluster on each page?
J.R. Allen
0 Kudos
Message 2 of 6
(3,373 Views)
Here's what I am trying to do. I am writting a program that runs a test defined by the user. The test is composed of a list of steps, each of which can take one of N forms, say "power-cycle", "multimeter", and "stimulus-responce". Each of the different step types has different parameters that define what the step does. (The actual steps types are different than this and there are alot more of them, but you get the point).

Now I must have a data structure to hold this info internally and I must provide a GUI for the user to edit this structure to create new custom tests. This is how I would create this data structure for this in C:

struct {
char step_name[MAX_NAME_LEN];
enum {type1, type2, type3} step_type;
union {
struct Type1Def type1;
struct Type2Def type2;
struct Type3Def type3;
} step_def;
} TestDef [MAX_TEST_LEN];

In LabView this translates into: (I moved all the union elements out to the containing struct (cluster) since labview doesn't have a union, and it's only purpose is to save memory)

Test Def (1-D array of)
Step Def (cluster of N+2 elements)
Step Name (string)
Step Type (enum {type1, type2, type3})
Type1 Def (cluster of ???)
Type2 Def (cluster of ???)
Type3 Def (cluster of ???)

It would be great if the data stucture for holding this data could also double as the user interface for manipulating the data - as is normally the case with LabView.

Now onto your comments:
Instead of the "super cluster" with subclusters, could you just use a tab control with a subcluster on each page?"

I would love to do this - but the tab control would need to be inside of an array like I described above, which isn't possible.

I think what I'm going to end up doing is to create the data structure like I explained above, and then create a different front panel for editing the data, where I can slap the substructures into a tab control, and then have another contol on the side the chooses which item in the array the user is refering to.

I hope this explains my problem better. If you know of a better way to do what I'm doing let me know, otherwise don't worry about it. I just figured I'd check and see if upgrading to LabView 7 would solve all my problems, bring world peace, and end all poverty. But I guess I'm just going to have to bite the bullet and get down to work, and live with a few uglies 🙂
0 Kudos
Message 3 of 6
(3,373 Views)
Here is a simple way you can implement this. The type enum selects which cluster type is visible. Of course, the tab control does this automatically but waiting that they could be but in clusters anr arrays, you do have to wire the functionality yourself.


LabVIEW, C'est LabVIEW

Message 4 of 6
(3,373 Views)
Awesome, that will work perfectly! Thank you.
0 Kudos
Message 5 of 6
(3,373 Views)
You could get the professional level package and write a polymorphic vi.

You could go the old fashion route and create your data structure in a
string.
0 Kudos
Message 6 of 6
(3,373 Views)