Handler or function
Dan Shafer
revolutionary.dan at gmail.com
Sun Aug 6 16:12:39 EDT 2006
Liam....
If all you're doing with the calculation results is populating a field, then
it probably doesn't matter a whit whether you use a function or a handler.
The only real difference is that when you call a function, you have to be
aware that it's returning a result and that you MUST call it in such a way
that the result is dealt with (even if "dealt with" means throwing it away).
Thus if you had a handler called calcPrice and a function called calcPrice,
you'd call the handler like this:
calcPrice x, y
and the function like this:
put calcPrice(x,y) into field "foo"
or wherever you want it.
(You probably already know this stuff and if so I apologize for wasting your
time with something obvious but I often find that assuming isn't useful
either.)
On 8/6/06, Liam Lambert <liamlambert at mac.com> wrote:
>
> Hi all I have am using this handler to calculate different prices
> for children adults and others
> The aPrice cPrice and the oPrice are different prices selected from a
> fld with different prices in it
> the handler works fine my question is should I this with a function
> or is there a better way to do this
>
>
> on fCal
> set the numberFormat to "#0.00" -- dollar format
> put field "aPrice" into theaPrice -- the selected adult price
> Put field "cPrice" into thecPrice -- the selected child price
> put fld "oPrice" into theoPrice ---other selected price
> put field "child" into theChildNumber --the number of children
> put field "adult" into theAdultNumber --the number of adults
> put fld "other" into theOtherNumber ---the number of other
>
> put (theChildNumber * thecPrice) into field "Childprice"-- * the
> number of children by the price
> put (theAdultNumber * theaPrice) into field "Adultprice"-- * the
> number of Adults by the price
> put (theOtherNumber * theoPrice) into fld "Otherprice"
>
> put field "Childprice" into theChildprice
> put field "Adultprice" into theAdultprice
> put fld "Otherprice" into theOtherPrice
> put theAdultprice + theChildprice + theotherPrice into field "Total"
> end fCal
>
>
>
> Thank's Liam
> IRELAND
> liamlambert at mac.com
>
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dan Shafer, Information Product Consultant and Author
http://www.shafermedia.com
Get my book, "Revolution: Software at the Speed of Thought"
>From http://www.shafermediastore.com/tech_main.html
More information about the use-livecode
mailing list