Yes, that is the way to do it. If you have one side as Input Pullup and the other side on a output, you can poll all the lines as required.
Once you have detected an input, you will need to cycle the outputs to find the exact button that was pressed.