LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Tab control as state machine

Hi,

How to use tab control as the enum of a state machine .

Thank you .

Best Regard.

0 Kudos
Message 1 of 6
(2,154 Views)

I wouldn't.

 

Tab controls are mainly a visual display element to organize controls for the user.  It is very rare that the tab control's value is actually used within the logic of the program.

 

The state machine should be controlled by an enum that has nothing to do with a tab control.

 

Message 2 of 6
(2,144 Views)

@Emna20 wrote:

How to use tab control as the enum of a state machine ..


As Ravens said, your request is unusual and not something you typically want to do. Still, it should be equally easy to do because there is nothing special about a tab enum. Where did you run into roadblocks? Please show us a simplified version of your code.

 

Still, if you want to do it, you should turn the tab control  into an indicator so it cannot be changed by the user at runtime and create states for each tab. You can even hide the tabs and just show controls and indicators relevant to each state on each tab page. Also make the tab a typedef, especially if you have a lot of its diagram constants floating around.

 

0 Kudos
Message 3 of 6
(2,123 Views)

@altenbach wrote:

@Emna20 wrote:

How to use tab control as the enum of a state machine ..


As Ravens said, your request is unusual and not something you typically want to do. Still, it should be equally easy to do because there is nothing special about a tab enum. Where did you run into roadblocks? Please show us a simplified version of your code.

 

Still, if you want to do it, you should turn the tab control  into an indicator so it cannot be changed by the user at runtime and create states for each tab. You can even hide the tabs and just show controls and indicators relevant to each state on each tab page. Also make the tab a typedef, especially if you have a lot of its diagram constants floating around.

 


I think there are issues when you try to use a tab enum as a typedef because the copies don't update properly.  I forget why.  I just remember the pain...

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 6
(2,084 Views)

@billko wrote:
I think there are issues when you try to use a tab enum as a typedef because the copies don't update properly.  I forget why.  I just remember the pain...

I have not seen that. However it is a pain having to edit the type definition to e.g. to add a new tab. ... and forget about changing the tab order. Gave up quickly of typedef'ing tab controls, even if not used a state variable. 😉

0 Kudos
Message 5 of 6
(2,060 Views)

I've done some programs which basically work like that. Imagine a wizard type application which steps through tabs for the information, but i'd use a normal Enum for the states as it's common to need some extra states.

Otherwise it should work like any enum based state machine, connect it to a Case structure within a for loop and change tabs as needed for next state.

 

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 6
(2,030 Views)