09-01-2010 07:32 AM
Is there a way to read the current frame (or state?) of an Event Structure?
09-01-2010 08:00 AM
Without scripting I don't think so.
With scripting, I don't know.
I'm a bundle of help today.
09-01-2010 08:11 AM
Normally a program would not stay in an event case for long enough for the phrase "current frame" to have much meaning. What are you trying to do?
Lynn
09-01-2010 08:12 AM
I'm assuming you're talking about an edit-time feature.
In older versions there wasn't. I don't remember seeing anything about 2010 adding such a property, but it's worth checking out, since it was requested. If you search the LV APIs group, you can find some older discussions on this.
09-01-2010 08:20 AM
@johnsold wrote:
Normally a program would not stay in an event case for long enough for the phrase "current frame" to have much meaning. What are you trying to do?
Lynn
Like tst assumed, it's for edit time use. Some events take a few seconds, and the progress would be nice to watch on the FP like you'd typically do with a state machine, and with dynamic events (as opposed to just user events), it would be nice to see where the structure is going.
I have tried something with scripting as shown, but it's not much help. There's no property "Current Frame" or similar. Visible Frame (as shown) doesn't do it.
09-01-2010 08:31 AM
The simple solution is to just put a string constant in each frame of the event structure that has the name of that event typed in it, and wire it out through a tunnel to a string indicator.
09-01-2010 08:39 AM
@broken Arrow wrote:
Like tst assumed, it's for edit time use.
When I said edit-time, I meant a situation in which the VI is NOT running. Such access can be useful when creating various editing tools.
Your case is run-time, and I would agree with the others that using a string is better (not to mention not using the event structure as a state machine, but that's another discussion).
09-01-2010 08:51 AM
@Ravens Fan wrote:
The simple solution is to just put a string constant in each frame...
Ahow about my New Idea? This would be simpler and more robust.
09-01-2010 08:54 AM
The reason that the VisFrame EventStructure scripting property is not useful is that it only defines what frame is showing on your block diagram, and when you are running, it doesn't matter which is showing. If you look over at the BD, one frame is showing, but the VI could be executing a different frame at that time.
The exception, (and I haven't tried this to test it out), would be if you have highlight execution turned on since the BD changes its appearance from one event case to another depending on which code is running. However, if you are doing something to debug event structures, then you probably aren't going to have Highlight execution turned on as that would completely mess up any event timing you are trying to look at.
09-01-2010 08:57 AM
Most of the events offer a control ref node taht can be used to get the name of the control associated with the event.
Does not help with the timeout case of course.
Ben