Hi John
Well, all good things come to whom, that waits for them...

On the newest and biggest Pis, people install fpc/lazarus and do their programming directly on the Pi, but with a 4, it'll prolly depend on the amount of RAM you can stuff onto it, it might be a bit cumbersome to program in Lazarus on it...
However, fpc + fp (fpc's TUI-IDE) will run pretty well... 
Then others have good results with coding, on a lappy or a stationary PC and then transfer the compiled programs to the Pi4 via usb etc. This option is considerably better for your coding-sessions, because of the "more muscles" on said computer.
For the Ubuntu question goes: Does it run lightly and happy on a Pi4?!? If not, you'll prolly be annoyed with it, people tend to be in both camps: 1) Ubuntu installed or 2) Using the Raspbian (or whatever it's called) OS... YMMV
Now the important part: There are many threads on this forum, about utilizing Pis for this and that, so SEARCH THE FORUM for knowledge and code bits, they come in different shapes and sizes, the projects people build with Pis and pascal...Your project sounds straight-forward enough to be doable =^
Regards Benny