From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

typedef enum to typedef tab control

Solved!
Go to solution

I have a typedef enum that defines what the DUT is for my automated test fixture. This enum is used all over my code in order to decide which tests to run and how to interpret results, etc. I also have a typedef tab control (well tab indicator to be precise) which has a page for each of the DUT's with different indicators for each test that will be run on that specific DUT.

 

I would like to use the typedef enum to select which page of the tab indicator to display. I am able to do it with brute force of just a U32 converter like this:

 

ENUM_TO_TAB_BASIC.png

 

But would prefer (due to my anality) to eliminate that ugly red coercian dot (and based on the size of the code, any memory I can save helps too).

 

I have tried many things and none seem to work. This way, using a type cast, doesn't work.

 

ENUM_TO_TAB.png

 

And neither does this using variants (though it does work with this little piece of example code, maybe because my test fixture is an executable?):

 

ENUM_TO_TAB_VARIANT.png

 

With the variant version, my test fixture throws an error 91 saying the data types are not compatible.

 

Anybody have an idea how to convert between these two without that ugly coercian dot?

 

 

 

0 Kudos
Message 1 of 5
(2,874 Views)

I guess I should also say, unlike my sample code above, the enum and the tab control have different number of values. ie:

 

Enum                        Tab

page 1                      page 1

page 2                      page 2

page 3                      page 3

something 1            something else

something 2

0 Kudos
Message 2 of 5
(2,871 Views)
Solution
Accepted by topic author bshover

Why not write a little VI with Enum input and Tab output? It would just have a case structure internally. You can make the icon small so it does not take much more space than the to U32 conversion.

 

Lynn

0 Kudos
Message 3 of 5
(2,860 Views)

Make sure that both your enum and tab control have the same representation (e.g. both U32 or both U16, etc)

 

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 4 of 5
(2,859 Views)

I very much like this proposal.

0 Kudos
Message 5 of 5
(2,854 Views)