04-11-2016 03:33 AM
Hi
I have a problem : i use a tab control with multiple pages , the first three pages run but when i add other page only the last one run.
please can any one help me.
04-11-2016 03:51 AM - edited 04-11-2016 03:55 AM
Hi Chaabane,
Dont use these many case structures for your code. you have used 4 case structure and all the four you have marked default for a condition so what happens is irrespective of the tab input all the case will run simultaneously . so you a single case structure and pass the tab control as input (Refer image below) and place the corresponding code inside the particular case and your issue will be solved.
The reason behind your 3page tab not showing any issue is that you havent used any loops for the 1st 3pages, for your 4page tab program you have used while loop so you are getting this error.
Kudos are Welcome 😄
04-11-2016 08:18 AM - edited 04-11-2016 08:20 AM
You are using the tab control wrong.
A tab control is meant to be an organizer for your front panel controls. It is very rarely actually a control that is read and somehow used to control your VI. The architecture of your VI needs to be redone because the tab control is read once at the very beginning of your program, never to be read again. If it is anything but the 4th tab, one of the other case structures execute and your VI immediately stops.
Redo your whole architecture. Have one while loop where everything occurs, or have 4 separate while loops one for each type of control system. Get rid of the case structures, and the tab control terminal shouldn't need to be wired to anything.
04-12-2016 12:16 AM
Hi RavesFan,
The statement you gave is wrong .Tab control is not only meant to be an organiser for front panel controls it can also be used as control. it is actually a enum control. kindly see to the descriptiion below.
On the block diagram, the tab control is an enumerated control or indicator. As a control, you can pass the value of the active page to other block diagram nodes. As an indicator, you can wire nodes to control which page is displayed. You do not need to wire the tab control terminal for the tab control to operate.
Tip You can wire the enumerated control terminal of the tab control to the selector of a Case structure to produce cleaner block diagrams. With this method, you associate each page of the tab control with a subdiagram in the Case structure. You add the control and indicator terminals from each page of the tab control—as well as the block diagram nodes and wires associated with those terminals—into the subdiagrams of the Case structure. If you need a component of a VI to run continuously, even when its controls are hidden, do not use a Case structure, because the structure executes only one case at a time.
Refer to the Link below for details
http://zone.ni.com/reference/en-XX/help/371361J-01/lvhowto/creating_tab_controls/
04-12-2016 05:09 AM
@SanthoshJoel wrote:Hi RavesFan,
The statement you gave is wrong .Tab control is not only meant to be an organiser for front panel controls it can also be used as control. it is actually a enum control. kindly see to the descriptiion below.
Let me put it this way. Nearly every time I have used the tab control to control how my application runs, it turns into a big giant mess. Just because you can do something does not mean you should. What the OP has here is a huge archetectural issue. In fact, I would say that the OP should actually have 4 different VIs.
The only time I use the tab control's enum is on a value change with an event structure to do something for the GUI (usually disable certain controls).
04-12-2016 05:50 AM - edited 04-12-2016 06:04 AM
Hi Crossrulz,
It depends on the type of application. If its a simple one and the need arrises its not an issue. Since you are a good programmer you are saying this but we cannot expect everyone to be a good programmer. We can guide them to be a good programmer. But what i meant to say is even in NI description for Tab Control they have said that.
04-12-2016 05:55 AM
SanthoshJoel wrote: Since you are a good programmer you are saying this but we cannot expect everyone to be a good programmer.
I would not hire a bad programmer. If you are not a good programmer, then you should learn from the good ones. Just because somebody is not a good programmer does not mean you should teach them bad habits. The idea is to teach them good habits so that they may become a good programmer.
04-12-2016 06:18 AM
@crossrulz wrote:I would not hire a bad programmer. If you are not a good programmer, then you should learn from the good ones. Just because somebody is not a good programmer does not mean you should teach them bad habits. The idea is to teach them good habits so that they may become a good programmer.
See to this . ...
04-12-2016 09:00 AM
In the image you posted it says "Tip: You can wire the enumerated control to a case structure.... " It doesn't say "you should" or "you must".
Also read the later part of the paragraph, "If you need a component of a VI to run continuously, even when its controls are hidden, do not use a Case structure, because the structure executes only one case at a time."
That is the situation you have here.
My statement is not wrong. It fits entirely within the statement NI made in that help file. When you come to the forums asking for help, I suggest you listen and learn rather than dismissing people's statements to you. People will be much more willing to help you be successful in your project.
04-12-2016 09:40 AM - edited 04-12-2016 09:45 AM
@chaabane wrote:Hi
I have a problem : i use a tab control
We love you chaabane! (Anyone who has ever heard of "The Big Book" should get that joke)
Seriously, I dislike "Tab Containers" Not Tab Controls- they are Containers!
Are you using the "Run Continuous" Button? Don't do that! Put a while loop around the Tab Container so that its value may be read more than once. And what is the point of single case case structures? The semantics of three of your Case stuctures is:
If Tab Value is equal to "XYZ" do "This" Otherwise, do the same thing. Sounds funny when you state it that bluntly doesn't it?