LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Closing the Front Panel with Event

Solved!
Go to solution

Hi All.

I have been reading in the forum and on the web however I seam not to get how to close the Front panel with an event ,I have the similar issue when my executable runs and the user press the stop button the Vi stops however the Front panel stay on screen and just change to the normal Front panel with all buttons and menu's similar to the one in the editor.I have seen various ways here in the forum to close the panel but fail to understand how to correctly setup an event .

At the moment if I can just use the stop button to stop the Vi and close the panel will be fine as a next learning I will then look deeper into using the X button as  standard windows.

I have placed a event structure in the main loop with a time out(to avoid the event wait for ever and block the main loop) I the set up the Stop button change value event and a Panel close event .

a.jpg

 

do I need to place any code in here ?as my stop button state is read from a local variable in the main loop and the 2 parallel loops.

b.jpg 

 

What should I do inside the panel close event to close the panel ? (the shift regeister in the picture is for the state machine states)

I apologize for my ignorance I am lost here !

Regards 

QMESAR

---------------------------------------------------------------------------------------
Learning is an endless process but needs to start some where
0 Kudos
Message 1 of 3
(1,511 Views)
Solution
Accepted by topic author QMESAR

You should not use the plain "panel close" event, only the "panel close?" filtering event, discard it, and do whatever needs to be done before the VI closes itself.

 

Do you need to run special shutdown code if the panel close is attempted (confirmation dialog, hardware shutdown in the correct order, write a log entry, etc.).

 

What's the point of the local stop variable? That's not good architecture and can cause a race condition. Can you show is the entire code?

 

0 Kudos
Message 2 of 3
(1,508 Views)

Thank you verymuch for your reply .

Yes I can share the Vi I am working on now ,the first one you helped me get going is running with the test team all day long on the test track.

The Vi does not have the internal control function yet only the indicators /controls and the 3 loops needed ,

However I am trying to implement a state machine which does the following

(1) when the operator press the run button the SM should open the USB ports 

(2) Once USB port is open it should initialize the system and needed things for the machine 

(3) Then it should move into the Powerup state which Power up the machine in a defined sequence as per       datasheet.

(4) then SM should go into the Control Sate from where the operator/test Engineer can run various speeds Currents and power points etc.

(5)when the Operator switch the Run button OFF the SM should go into Shutdown mode (state) to rundown the machine at a specific sequence and a specific order of releasing the High Power /Currents

(6) then the SM should close the USB Port /release it.VI should still be running at this point if the operator again select the Run button the process should  run again from point 1.

I am running state machine on a second controller on my desk and I can see the state follow correctly.

Then at last when the machine is power down and the operator decide to close for the day he press the close button and the Vi should stop to run and close preferably over the X button as in Windows however with my steep learning curve I opt for a button maybe in the V3 from the VI the X button ,now I am focusing on the State Machine and some special control algorithms for the application of the machine

Sorry for the long story  I wrote  Smiley Embarassed 

Kind Regards 

QMESAR

---------------------------------------------------------------------------------------
Learning is an endless process but needs to start some where
0 Kudos
Message 3 of 3
(1,498 Views)