LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

old values event structure detected

Hi I am using labview 7.1
I am puzzled why the old values are still detected by event structure,  even though the button is already is disenabled programmatically and the event structure is in another case structure..
Here I have main while loop. Inside it, there are two case structures.
As usual, the data always flow from left to right, so I put the event structure in the while loop in the one of the two case strucuture (the right one)
The stop button is used in two case structures. After the stop button is disenabled programmatically in the left case structure before entering the case rigfht structure.
So here the event structure in the right case structure still detects the old stop button's value.

Here's the pic attached.


Is there a way that the event structure must register the latest updates on the state of the stop button?

Clement,

Message Edited by astroboy on 05-08-2006 08:57 PM

0 Kudos
Message 1 of 14
(4,535 Views)
Hi. again. Here's a similar version of my big program.
You can see that the initate section is used even though initate button is disenabled programtically in other Case structure A before the event structure in Case Structure  B..

Clement
0 Kudos
Message 2 of 14
(4,524 Views)
astroboy,

maybe I am not getting the problem but it is acting exactly as I would expect. One thing is I don't see where you are disableing or enableing the control. Maybe this is just symantics, not sure?

In any event (no pun intended) if I understand the confusion it's this, you seem to be writing a new value to the control and the event still registers what you think is the old value. The event loop as written looks for value changes for the control and does "something". The "new" and "old" values are for lack of better term "frozen". If you happen to write to the control a new value before the event is handled that doesn't matter. It's going to use the value and the value change of the event.  The event uses the "old" and "new" value of the control at the "time" of the event. It's not necessarily the "current" value but rather the relevent values of the event in question. 

Does this make sense?

Cheers,

--Russ
0 Kudos
Message 3 of 14
(4,523 Views)
Hi Russ Evans,

It does not act as i would expect it.
In the case structure A (at your left hand), there's one that disenables the initate button by programmatically in true section.
So after the initate button is pressed,  it is disenabled in the true section after press.

Because it is disenabled before another B case structure that has event structure inside, therefore the event structure should not register any changes from disenabled initated button.

Does it make sense to you?

But here the event structure still registers.

Don't tell me that the event structure is alive everywhere  even before the case structure (B) is opened?

Cheers: smileyvery-happy:
Clement
0 Kudos
Message 4 of 14
(4,516 Views)
Hi I am sorry. I overlook your reply.  So that means event structure will still register the changes even it is reverted back to same state.
I have changed the "changed value" to "mouse down". But still it is same.
So what better solutions u have for me?

Cheers
Smiley Very Happy
Clement
0 Kudos
Message 5 of 14
(4,517 Views)
Astroboy,

In a sense, the events are very much "alive" at all times, but they are normally handled by the OS.  If I undertand correctly, LV simply sits between the event and the OS when the event structure is used.

I also don't see the part of the code where you're disabling the boolean control.

The fact about the event handler firing even if a control is updated with the same value is correct.  In this way, the correct text for the event handler should be something like "Value updated" instead of "Value changed" because the event fires sometimes even if the value itself doesn't actually change.....

Are you sure you're disabling the control before launching the event structure?

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 6 of 14
(4,513 Views)
Hi Shane.

I don't mean it is disenabled by physically, but rather by programmatically.
See the true section in the case structure (A or at your left hand in front of PC)

So after the initate button is pressed, immediately the initated button is reverted back to state by programmatically.
Then it is now disenabled, at that time event structure is not yet in use until  the other case structure (B) opens up
to use event structure incase of data still flowing from invert function.  Then by right the section ""timeout" section in event structure should be used.

Does that mean event structure is still used even if it is in the unopened case structure? What about the spilt-second changes when event structure is used veru much later

Is it possible for us delay the use of event structure or is there a way to detect the new changes at the lastest time?

I am still puzzled.

Cheers

Clement
0 Kudos
Message 7 of 14
(4,504 Views)
Astroboy,

you ask "So that means event structure will still register the changes even it is reverted back to same state."

the answer is a resounding yes. Once the event is triggered there is no going back. Actually some events can be discarded but not for your case. But againg "old" and "new" values may have little relationg to "current" value.

The "old" way of doing event loops was to programatically poll all of the controls and then handling those controls that changed "states" since the last poll took place. Depending on what was happening in the code it was possible to press a button on the front panel and then press it again before the first event was handled, thus "missing" the first event. With the true event loop in LV now this doesn't occur. Once an event has been triggered there is no going back. It doesn't matter if you press the button, or mouseover, mousedown or whatever. If the user tries and "reverse" the event say by pressing the button again not only does it not "reverse" the event but it triggers yet another event. Even if you try and "reverse" the event programmatically as you have found this is to no avail. These events are being queued and will be handled in the order received.  As Shane points out this is done at the OS level.

Cheers,

---Russ
0 Kudos
Message 8 of 14
(4,501 Views)
Hi Russ and Shane.

Thanks a lot.

If this is the case, Does C++ perform better than Labview in the event spilt-second changes from the contol.
I am aware that detection is handled by OS.

Clement
0 Kudos
Message 9 of 14
(4,499 Views)
Astroboy,

There's a time value passed through the event structure.  It only has a resolution of 1ms, but it tells you as far as I know the time the event was registered.

You could get the ms count just before the event structure executes, and only process eventy which are registered afterwards.  If you find that the events you're processing are registered AFTER disabling the boolean, then you need to dig deeper.

Shane.

PS, I can't look at your code, I've only got LV 6.1.

Message Edited by shoneill on 05-09-2006 08:47 AM

Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 10 of 14
(4,493 Views)