12-07-2009 03:32 PM
I have a vi which has an event structure on it.
it has the following events:
start test
panel close?
in the start test event, the check box "lock front panel until event case for this event completes" is set to false. for me to abort the test by pressing the start test button again.
inside the start test event , theres a loop where it does different test steps.
the problem is when i am in the loop inside the start test event, and when i click the x button in the panel, it the front panel locked.
is there a way, that i can get rid of the x button or in the event panel close, can i have the 'lock front panel until event case for this event completes" unchecked?
please advice.
12-07-2009 10:15 PM
You can do what you are asking by going into VI Properties -> Window Appearance -> Customize -> de-select "allow user to close window". This will hide the X button. It's not pretty, as most users expect to be able to do this.
Panel Close? is what's called a "filter event" (as opposed to a notify event) the help spells it out better than I can, but basically notify events trigger after they've happened, while filter events trigger before they have processed and give you the option of discarding the event. You can't unlock FP events because it must know how you want to filter the event - discard it or not?
1) why stop the loop with the start button?
2) you have a loop inside an event structure? Try putting the loop outside the event loop so that you decouple the event actions and the test operation. Look into "producer consumer" or queued state machine or what have you. Heck, even an event-driven state machine would be worth looking at.
12-08-2009 07:54 AM
Thanks for that info on disabling the x button.
1. why stop the loop with the start button? -- before the test starts, the label on the start test button is "START TEST". But once it starts the test (TRUE), the lable will be changed to "ABORT TEST".
Same button to run the test and abort the test.
2. Yes, I have a loop outside the event structure to loop the events.
I have a loop also ince the START TEST EVENT. The purpose of this loop (inside START TEST EVENT) is to run series of sequence in a given time or an interval test sequence (do plot, do thermal scan...).
To terminate the loop (inside START TEST EVENT), is once the START TEST (ABORT TEST) will be pressed again (change value to FALSE). I am okay with this, this works fine.
The problem i encountered is that when the process is during the start test (inside START TEST EVENT, inside the loop of START TEST EVENT), when i pressed the X button, the front panel freezed. The reason for this is that it still waiting to finish the loop and go proceed to do the procedure inside the PANEL CLOSE? EVENT.
additional info:
the reason that i have put a panel close? event, is to discard if the user will press X button. The user should use the exit button to terminate or close the application.
inside the EXIT Button EVENT, this event will shutdown all the sources (for safety purposes) before it terminates the application .
so, i probably disable the X button.
12-08-2009 08:09 AM
by the way, can i disable the X button programmatically?
can i change the value on "ALLOW USER TO CLOSE WINDOW" programmatically?
What i have in mind is that i will disable it if im in the loop (inside the start test event) and enable it again when im done with the test.
12-08-2009 08:53 AM
cmdrb wrote:by the way, can i disable the X button programmatically?
[...]
You can set theVI property FP.Closeable to false.
hope this helps,
Norbert
12-08-2009 05:25 PM
cmdrb wrote:
2. Yes, I have a loop outside the event structure to loop the events.
I have a loop also ince the START TEST EVENT. The purpose of this loop (inside START TEST EVENT) is to run series of sequence in a given time or an interval test sequence (do plot, do thermal scan...).
To terminate the loop (inside START TEST EVENT), is once the START TEST (ABORT TEST) will be pressed again (change value to FALSE). I am okay with this, this works fine.
I understand that the event structure is inside a while loop. What I'm suggesting is that you put the loop where your sequences are outside of both of those. Your program would have two while loops next to each other. When an event structure contains code that takes time to run, it causes the problems you're seeing.
12-17-2009 12:34 PM
sorry for the late reply...got stuck on other project
i have it working.
here's the sample of the vi..
12-18-2009
02:20 AM
- last edited on
06-11-2025
12:24 PM
by
Content Cleaner
Sorry, but your VI is not working correctly. You have implemented at least one of the caveats of the event structure.
Luckily, Ton made a webcast recently which is talking about this issue.
The problem in your code is if you press Test/Abort, you still can press Exit. Doing so will lock up your panel. This is a no go.
Rule of thumb: Never have more than a single event structure in your application handling events from the same source (in your case the UI).
Second point: Get rid of the sequence structures. With a proper architecture, they will be obsolete.
hope this helps,
Norbert
12-23-2009 09:06 AM
Thanks Norbert for the info...
The real vi that i have on the project has disabled the exit button once the test still running or with in the loop.
For your second point, what should be use instead of sequence structure?
thanks.