A purpose of Erel's code is to distinguish an "action" in Panel_Touch (Action As Int, X As Float, Y As Float). If a touch is cancelled, Action will be 4 instead of 1 (ACTION_UP).
In some situations this is useful. But your code should be ready to receive 4 instead of 1.
If to open a source code inside XUI Views.b4xlib, SwiftButton in p_Touch subroutine processes TOUCH_ACTION_DOWN, TOUCH_ACTION_MOVE and TOUCH_ACTION_UP. If action = 4, SwiftButton does nothing (so button remains 'pressed').