Friendlier curses with ruby
I’ve been working for the last month or two, on an application builder for ncurses, using ruby. I’ve been learning both ncurses and ruby and thus have written and rewritten and refactored my work, so many times ….
Finally, the other day I thought i would just try out creating a field in pure ruby (on an ncurses window). (Putting aside my 2 months work) In about a couple hours, I HAD a working field. Along with a FORM and navigation etc. All in ruby, you can create the FIELD whenever you want, change all attributes whenever you want … none of the complicated ncurses hassles and sequencing etc.
Best of all the code is very small, and one can improve, debug etc it, whereas with ncurses you have to accept what is provided with all its limitations. Don’t get me wrong, I have enjoyed working with forms and fields and even multiline ones, but ultimately even after writing umpteen wrappers every which way, it still was NOT fun.
So then I created a label, and then a button. It was quick! All in my hands. I looked up the TK interface in the Pickaxe and made mine similar. In ONE DAY i had all this ready.
Got stuck making a menu bar. A single level was easy, but submenus really had me. Took a full day to get that done. That was the hardest.
Day 3: Zipped through a message box, then took 5 minutes to extend the button and make a proper checkbox. Took 2 minutes to extend that and make radio buttons!!!
Day 4: I made a multiple line field (Textarea) – again tired of the limitations of the ncurses ones … spent quite some time doing word wrapping while entry, editing, deleting etc. This is one of the tough ones that needs a lot of work and testing. You should be able to dump data from outside and write it out and have it just perfect. The current one has no limitation as far as size is concerned. However, with all the situations I am trying to cover, it could be buggy yet.
Somewhere in there, i also made a scrollable list box.
The whole thing actually comes to two pretty small files, almost no dependencies, looks very much like the “links” browser’s menu bar and message box.
These look much cleaner and more profession that what CDK looks like.
I am going to start putting up examples, code samples and images in the next few days.