Ok, JianKang, let's see if we can make it.
You want to manage events generated in the inner loop, don't you, those events can be managed, there is no problem!, you just need to change orders.
You have, let's say
1.- a while
2.- an Event Case
2a.- event1
2b.- event2
2c.- event3
2d.- event4
3.- another while in which events are generated inside 2c
3a.- event1
3b.- event4
(being event1 and event4 the same for both loops)
try to change to
1.- the same while with a boolean in Shift Register initialized to false
2.- an Event Case
2a.- event1
2a1.- case ShiftRegister=True
2a2.- case ShiftRegister=False
2b.- event2
2c.- event3
--- here you see the value of boolean. If it's false, this is the first time you enter here, so you set it to true.(simulating you are inside the inner loop) ---
2d.- event4
2d1.- case ShiftRegister=True
2d2.- case ShiftRegister=False
---------------
When the Event in which you had the inner loop occurs, change to true the value in Shift Register and continue treating events.
When you catch an event for the old inner loop, compare if the shift register value is true. If it is false, you haven't get into the inner loop. If it is true, you are in the inner loop.
reset the shift register when the inner loop condition is met
I hope this time is more clear. Does this modification modify considerably you code? I think this can be a good solution to catch all events.
Aitortxo.