Odd behavior when selecting customer code in different way (Customization)

SOLVED

Hi All,

I am doing customization  on few standard Sage 200 forms, and I found an odd behavior when selecting customer code in different way.

For example, on Sales Ledger>New Invoice, we can select customer code in 3 methods: 

1. click dropdown and select the customer code.

2. type in customer code and tab away

3. type in customer code and click outside of the customer code area (to be exact CustomerInvoiceLookup field.)

My customization works like this:

once user select customer code, I capture the event with CustomerSelected(), check if the exchange rate has expired, and let user decide what to do next.

If user click "Yes", then proceed. This is not a problem.

If user click "No", then I will close the form by calling closeButton.performClick(). It work well if I use method 1. But for methods 2 and 3, it did not work.

Then I monitor the standard event:

Using method 1, these are the event triggered.

Using method 2 and 3, these are the event triggered

All methods have CustomerSelected event but only method 1 works ok. I have used CustomerChanged and Leave, but it still the same. Anyone knows why? Thank you.