Thanks for your answer. I apparently need study what are pullup and pulldown concepts as I've not found the logic of your explanation yet.
The third diagram shows a voltmeter, not a source.
EDIT : I've made a big mistake in my program, set inputs as outputs. Now I clearly see the floating phenomenon.
For what comes next, I'll install pull-down resistors, pull-ups would not work because of the presence of diodes in the keyboard.
Thanks for help.