Hard code or portable code

hershrev hershbp at realtorsgroup.us
Thu Mar 4 13:51:05 EST 2004


Ok its up and running was my mistake did replace completely ,  it was 
twice because it had all the info of all the fields plus the info from 
the field itself.
thanks , hershrev
On Thursday, March 4, 2004, at 02:46 AM, Brian Yennie wrote:

>> Yes , All hats up for you.
>> Just a question, why when I write ...
>> put function () into field x it doesn't replace the old contents of 
>> the field ?
>
> Try this.
> Put the following in your stack script:
>
> function latestFields
>   local myVar
>   repeat with i=1 to (the number of flds)
>     put fld i after myVar
>   end repeat
>   return myVar
> end latestFields
>
> Now in a button script, do this:
>
> on mouseUp
>   put latestFields() into last fld
> end mouseUp
>
> The function by being in the stack script becomes available to you 
> whenever you need it. You may want to adjust where it puts the > results.
>
>
>> Now to compare if I write
>> on mouseUp
>>   repeat with x=1 to the number of flds
>>     put text of field x & return after y
>>   end repeat
>>  put y into fld 1
>> end mouseUp
>>
>> what is the difference besides function or message, speed wise or 
>> something else ?
>> thanks , hershrev
>>
>
> Functions and handlers (functions start with "function", handlers with 
> "on") should execute at about the same speed, both very fast unless 
> you are really counting your milliseconds. The convenience of writing 
> a function rather than putting the code into your button's mouseUp 
> handler is that you can reuse the function and call if from various 
> other places.
>
> HTH,
> Brian
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



More information about the use-livecode mailing list