03-03-2010 08:49 AM
hi everyone,
The event structure can handle multiple events at a time to do the same thing : looks like a logical OR. But I haven't found a way to sequence events to approach a logic AND. Example: first click on a Draw button and then enter the image would make the mouse cursor change. With an event structure, I can handle these 2 events separetely or together (either one would change the cursor), but i cannot make a sequence of events.
Is this possible to do that with an event structure?
I hope I am clear (sorry for the english btw). And thanks in advance.
Christophe
Solved! Go to Solution.
03-03-2010 09:02 AM
Hi Christophe,
you can use shiftregisters to store "old" values. Use events like "enter"/"leave" Control to coordinate the content of them.
Mike
03-03-2010 09:05 AM
I don't think this is possible directly. You will need to add state information to your event loop which would enforce the order of events and the logic rules you desire. In the event processing you would have to check if the required event occurred before this event. If it did, do your processing. If not ignore the event. Your first event would need to set this state information. You may also want to include some type of timeout so that the second event would have to occur within a specific amount of time.
This type of logic may be better handled using a producer/consumer architecture and a state machine in the consumer task.
03-03-2010 10:19 AM - edited 03-03-2010 10:24 AM
Mark Yedinak wrote:In the event processing you would have to check if the required event occurred before this event. If it did, do your processing. If not ignore the event.
That's exactly what I am trying to do! I am already working with a producer/consumer architecture and with a state machine in the consumer loop. I tried to add state info as you suggested in the event loop. But i do not know if i am doing this well. I attach a very small example where I try to demonstrate what I am trying to do with 2 booleans to be pressed in order.
Tell me what you think of the state info in the event loop.
@Mike : same solution as Mark if I use a shift register and a case structure inside the event loop?
03-03-2010 10:26 AM
03-03-2010 11:02 AM