|pMe||(Object) Reference to the PmgButtonState object where the event rises.|
|pEvent||(Object) Reference to object describing detailed information about the specific event.|
pEvent.NextState - (Long) Next button state.
It is preset by the system to the state value opposite to the State state.
By changing this preset value it is possible to suppress toggling the state if it isn't desirable (e.g. the action failed and that's why it isn't desirable to toggle the button state).
if (pEvent.NextState == 1)
// transition to state 1
// transition to state 0