A decoder based keypad
There was an unnecessary node, here is a cleaner Proteus schematic for a 5x5 keypad circuit that (i think) should work. All the input of the encoder can be NANDed to detect a button press which can be used to record the decoder inputs (column number) and the encoder outputs (row number).

NOTE: The encoder pins that are grounded (except the enable pin) were supposed to be at 5V.