Step 5: Be a Perfectionist

If you test your application, you will be able to freely scroll around they keypad, select any character and everything is as it should be.... well except for one tiny thing.

Notice, for example, if you press up while 2 is selected, it will jump to W. This is correct. But, if you press right while J is selected, it jumps to K, when really it should jump back to A. To please the almighty Gods of Consistency, we must wrap the keypad the same horizontally as we have vertically.

Remember the Mod function? It returns the remainder after division. We can use it to check if the current selected character is the first column. These are characters who's IDs are 0, 10, 20 and 30. Dividing each of these numbers by 10, leaves a 0 remainder and this is what we will check for.
This event must be ABOVE the original Upon pressing "Left Arrow" event otherwise 10 will be added a keypress early. Remember, MMF2 executes all events sequentially.

It is important to note that we actually only want to add 9, because from A to J is 9 characters, but we must add 10 because 1 will be subtracted an instant later when the original Upon pressing "Left Arrow" event is executed.

To wrap the keypad right horizontally, we need to test if the current selected character is in the rightmost column. This can be done using mod 10 = 9. This is because 9, 19, 29 and 39 all have a remainder of 9 when divided by 10.
As before, make sure sure this event is ABOVE the previous Upon pressing "Right Arrow" event.
8