LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

case structure with tab control-duplicating a case so that tab control will reflect the change

I have a case structure that is controlled by a tab control on the front panel. I have a case which I need a duplicate of, except with a few changes that I need to make to it.  So I tried to duplicate the case in the block diagram. However, a corresponding tab does not appear on the tab control. Instead, all the controls that are in this case duplicate in the same tab for the original case. 

 

I know that when I created the case structure and then added the tab control to it, all the correspoding cases appeared as tabs. But I do not know how to modify the structure in such a way that the tab control mirrors the updated cases. 

 

0 Kudos
Message 1 of 7
(3,627 Views)

The case structure and tab control are two different things. You can add tabs by right-clicking a tab on the front panel and selecting Add Page. This means that the terminal on the block diagram will now have another case option. If you ware this to a case structure, the case structure can be used to handle the new case.

 

When you duplicate a case, it duplicates everything inside of it, that means all your controls and indicators get duplicated as well. If you want to read fromthe same controls in more than one case, you either need to read from them outside of the case structure (suggested) or use local variables.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


Message 2 of 7
(3,618 Views)

Here are some free training tools primarily focused on LabVIEW and NI hardware to help get started.

 

NI Learning Center

NI Getting Started

-Hardware Basics

-MyRIO Project Essentials Guide (lots of good simple circuits with links to youtube demonstrations)

-LabVEW Basics

-DAQ Application Tutorials

-cRIO Developer's Guide

 

Learn NI Training Resource Videos

3 Hour LabVIEW Introduction

6 Hour LabVIEW Introduction
Self Paced training for students
Self Paced training beginner to advanced, SSP Required
LabVIEW Wiki on Training

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


Message 3 of 7
(3,616 Views)

Are you sure you want a tab control to control a case structure?

 

A tab control is a control primarily for organizing front panel elements, not for controlling execution of code.  I don't think I've ever seen a valid LabVIEW program that has that terminal wired up to anything.

 

If you want to add a tab to the tab control, then add it by way of the front panel.  (Right Click, Add Page)

Message 4 of 7
(3,611 Views)

@RavensFan wrote:

Are you sure you want a tab control to control a case structure?

 A tab control is a control primarily for organizing front panel elements, not for controlling execution of code.  I don't think I've ever seen a valid LabVIEW program that has that terminal wired up to anything.


Raven is right. One of my first applications (with no guidance this happens) was controlled via the tab control. Each time I changed the tab, the application went to a different case and the main code was within each case. Horrible idea. That application froze up so much, I had to keep an ice pick at my desk.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


Message 5 of 7
(3,605 Views)

Oh ok thank you for the tips. I will try to avoid using the tabs for case structure control, but what is the alternative? Can I just use a numerical control (I have several cases so cannot useT/F)? So far the tab control has worked for me, I think it is because I like how it separated the cases and front panel controls for the end user to understand. I have several controls and graphs specific to the each of the cases.

 

Maybe I can use a numeric control so that the numbers correspond to a particular tab/case? What is the generally used method in such cases?

 

The problem is that I am mofifying a program that has not been originally written by me and is being run in our lab for several years. too much change in front panel control may not be convenient for the end users of the instrument. 

 

 

 

 

 

0 Kudos
Message 6 of 7
(3,567 Views)

The idea is actually that you don't care which tab you are currently in. The ideal architecture just handles individual control events and goes from there. If button A is in tab 1 and button B is in tab 2, the user will have to switch between tabs to get between the buttons. Programmatically, they could click either one at the same time, but the tab control keeps that from being possible on the UI side of things.

 

If you're already deep int o someone else's code and don't have time to start with a better architecture, just stick with the case structure / tab control setup. It will take time to rewrite it without that setup. If you have the time, I highly suggest you look in to the Simple State Machine architecture template that ships with LabVIEW 2012 and newer.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 7 of 7
(3,555 Views)