LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a GUI for a State Machine

Hello,

 

I wrote a State Machine VI in Labview. Everything works fine, but there is one last problem, the graphical user interface. I only want to display the buttons for the possible exits transfers out of the current state and the controlling elements linked with them. I have about twenty states and a lot of them have several controlling elements, so all of them shouldn't be displayed at the same time.

Should I work with registers and can I control the window that should be displayed or is there a more elegant solution?

 

Regards

Simon

0 Kudos
Message 1 of 12
(3,407 Views)

I typically just disable and gray out the controls that are not applicable during a specific state.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 12
(3,403 Views)
You can use Property node "Visible" of appropriate button and make it false or true based on requirement.
Thanks
uday
0 Kudos
Message 3 of 12
(3,386 Views)

If I have just a few controls and indicators to hide or disable I usually just use individual property nodes.  If there are large numbers of GUI objects involved I generally put them on a tab control and then switch pages with its property node (you can make the tabs hidden).  This works especially well when there are distinctive groupings based on functionality.  I often color the tabs and use the same colors on main controls that aren't in the tab control but share functionality.  It all depends on the complexity and whether there are controls to logically group together.  AND you're willingness to spend time on cool GUI styling.  

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
Message 4 of 12
(3,363 Views)

Depending on how fancy you want to get you can use picture controls and use one common set of buttons. Change the picture, visibility of the controls as needed. The state will know what each button means within its own context. A bit more work up front but very flexible in the long run.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 5 of 12
(3,329 Views)

Hi karl_ender,

 

I prefer to create a cluster of reference of controls and indicators present on the GUI and in each state I will unbundled cluster and using property node and invoke node I will play with the controls for disabling, enabling the control and will bundle and same reference in the cluster.

You can use a shift register to move the reference in all the states.

 

this might helps you in solving the problem.

 

Thanks

Pankaj

0 Kudos
Message 6 of 12
(3,310 Views)

Thank you for your answers everybody!

 

Hello Niquist,

the idea with the tab control sounds very good. I played a little bit with a tab control and if I change it to an indicator and create an enum with values that have exactly the names of the pages of the tabcontrol, the tabcontrol can be controlled by the enum. I chose this way, because it seemed easier to me than property nodes, since the enum and the tab control are of the same type in the block diagram (and if I'm honest I'm not very familliar with property nodes...).  Now I have one more question left. I control my state machine with an enum and the case structur can automatically create a value for each enum value (I can just right click on the case structure and chose this). Can the tab control do this, too? Or do I have to type in every single case in my tab control?

0 Kudos
Message 7 of 12
(3,253 Views)
Hi Karl,

I think it can be done. Create property node for Tab control and take value parameter.
-You can read the first page or task, and in the same task you can write to the same property which page should come. Similar to how you can see in state machine example using enum.
Thanks
uday
0 Kudos
Message 8 of 12
(3,240 Views)

Hi Udka,

 

thanks a lot for your answer. I tried out what you said on a little example program and your suggestion works fine, I can control the tab that should be displayed wirth an enum. The problem that is left though are the values of the the single tabs of the tab control and their names. Is there a way, how I can manipulate the tab control, so the tabs have the same values with names as my enum? I have about twenty states in my state machine and while developing I change them a lot, if I want to control the property node of my tab control with the enum they always have to be exactly the same and I don't want to alter everything each time I change the enum of my state diagram

0 Kudos
Message 9 of 12
(3,220 Views)
Please tell me if i understood the problem clearly.
-Create all 20 states/tabs and create valid and proper names.
-Create value property node and make it to write.
-Create constant to the value you get the enum constant along with 20 names from there, just copy the same constant and use it wherever needed.
Thanks
uday
0 Kudos
Message 10 of 12
(3,209 Views)