Before using Xojo, my most recent programming tool of choice was FileMaker Developer 6 (which is now almost 15 years old!!).
When creating a field you could assign it a type ‘calculation’. Then within the code window you would use the usual logical expressions. The calculations were ‘global’. They were persistent and the value could be called anywhere within the program. They also re-calculated depending on other 'calculations"
What this meant was I could use them in a sort of ‘cascading’ effect, where it was easy enough to pull out values (that were dependent on others) and write simple truth tables based on many scenarios. Perhaps lazy programming, but it all worked very well.
The reason I ask is that I’m creating a simple XY graph - It’s all working perfect but the line of code is becoming too long - which makes it hard to understand and I would like to break it up a bit. Here’s the code:
[code]
Dim totalSamples as Integer
totalSamples = recordedGramsArray.Ubound
Dim forceY as Integer
For timeX as Integer = 0 to totalSamples-1
forceY = timeX
[b]GraphPicture.Graphics.DrawLine(timeX, (kGraphHeight-recordedGramsArray(forceY)), timeX+1, (kGraphHeight-recordedGramsArray(forceY+1)))[/b]
Next timeX
//Update the Canvas
cnvGRAPH.Backdrop = GraphPicture[/code]
The bold line is where I’d like to make a change. In essence all this is, is Graphics.DrawLine(X1,Y1,X2,Y2) but the code is getting hard to read and I need to add more to that line:
eg. (kGraphHeight-recordedGramsArray(forceY)*scaleFactorY). I’d like to be able to calculate that elsewhere first.
Hope it’s understood what I’m getting at. Your thoughts appreciated.
[EDIT] Shame about the bold text within the code not being bold. What the…?