Trying a custom handler for several math fields

dunbarx at aol.com dunbarx at aol.com
Sat Sep 14 15:55:34 EDT 2013



Vaughn.
Lots of hubbub. You have to love this community.


Back to work just a little, since we are trying to learn livecode. Do you see how a function, whether mine or not, would be used ubiquitously in your project to format fields to display a dollar sign? 


put "$" & goodNumber(field 1) + goodNumber(field 2) into field 3


This handles all data as strings, managing them robustly. The function can be placed in the stack script, so it can be called from anywhere. It is your job, of course, to remember to do so.


It occurs to me we need the "-" symbol as well. Can you write a handler that incorporates that in the right way? Please try, and write back often if you get stuck. As another exercise, can you write a more compact function that does the same thing? something along the lines of:


put newGoodNumber,(field 1,field 2) into field 3


or a custom command:


addCurrency field 1,field 2,field 3


This sort of exercise is essential to your moving forward. I would agree with Jacque's six week timeframe to get over the hump, but I would insist that 80% of that time be spent playing with your own stacks, not reading stuff. And remember, as others have also said, this is not a software package that you learn to use. It is a toolchest, the tools of which you must practice with to be able to use. I believe you must make a few stacks, of whatever kind. They cannot be so simple that you will not tear your hair out perfecting them. You are no longer a user. You are a developer.


Craig
 



More information about the use-livecode mailing list