How can I track if the cancel button was click?


There is no way to do this. You can fake it by comparing the initialValue with the returned value. If cancel is pressed then the initialValue is returned. This isn’t a very good way to do this because if someone uses the keypad by opening it and pressing ok without changing the value then you would get the same return as if you hit cancel.