Sunday 7 March 2010

Where There's a Will There's a Way

I'm starting to realize more and more that, however convoluted it may be, there is always a method to get my program to do what I want it to. Sometimes the method is messy. Most times, I just assume it's messy and skim over the really easy answer for a few hours.

So far I've completed compartmentalizing the input panel (and successfully). Now I'm working on the editing panel, which consists simply of a fill button, an add button, an identifier of the current value, a subtract button, and an empty button. Repeated 11 times, once for each character in the Matcode, of course. I've gotten the edit line finalized (just did that now), so that I can simply repeat that 11 times. I still need to code it to accept those 11 values, in order, as a Matcode and make the appropriate graphic. Also, as this is a tool mostly for myself as the eventual administrator of the simulation, I'll have a points system set up so that every time I add or subtract a value I see where I stand versus the average number of points I'd like for a material to have. Just as a guideline.

The final product will link the current code in the text input to the code being manipulated with the +/- buttons in order to make a more intuitive interface.

The work I've been doing the past couple of days has been frustrating. It took a long time to make something that still isn't actually very useful. Still, not all was lost. I finally understand how to make a subclass constructor actually do what I want it to. I had been programming a stupid little setup where the constructor simply set instance variables, then constructed a version of the superclass. It then returned this superclass in a separate method, making the class I defined essentially useless except as an instance variable holder. Turns out, and I've finally stumbled across this factoid, that the first line of a constructor's code is supposed to be a call to the constructor being used. Worse yet, all the times I didn't place this call, the program calls it anyway and I simply don't make use of it.

Ah, well, live and learn. Have to go back and edit a couple of constructors, but for the most part that won't take much at all. Time for bed, now. I'll be back tomorrow.

No comments: