The thing is that you’re asking for help with creating an entire system from scratch. It would take time to crate it, time to clean it up, and extra time to prep, comment and post it here. And there’d be many more follow-up questions after that, I’m quite sure.
Consider breaking it into small pieces to ensure you’re familiar with the basics first, and only then glue the pieces together.
Start with widgets, see if you can create a widget and bring it to the screen. Then work on having it intercept a key, then look into arrays… and so on.
If you have a more specific question, do tell.