Script Improvement Advice

Paul Charlesworth pcharles at chartermi.net
Thu Jun 5 08:57:03 EDT 2003


Cool! I'll need to read a little more to understand the "getline" part 
of the script, but the idea of allowing an end user to edit the content 
would be useful if they want a different number of sig figs for 
example. Not only that, but it would save me a lot of "put" and "set" 
commands.

Thanks,

Paul


On Thursday, June 5, 2003, at 09:12 AM, T. R. Ponn wrote:

> Hello Paul,
>
> This looks like a fun one.
>
> I'd do something like this:
>
> Create a scrolling field and name it Data1
> Put your data into the scrolling field in the form: 
> H,Hydrogen,1,1.08,37,N/A,........  with 1 element to a line.
> Set the script to:
> on mouseUp
>     hide me
> end mouseUp
> Now lock the field and hide it.
>
> Create and name all your buttons: Sb...Cr...He...H...  etc
> Do not put any script in these buttons.
>
> Create and name your "output" fields: Data2...Data3...Data4
> No scriptiung required in these fields
>
> Set the script of the card to:
> on mouseUp
>  if the optionKey is down then --If you want to edit the scrolling 
> field
>    show fld "Data1"
>    exit mouseUp
>  end if
>  get line (lineOffset(cr&the short name of the target&",",fld 
> "Data1")+1) of fld "Data1"
>  repeat with i=2 to the number of items of it
>    put item i of it into fld ("Data"&i)
>  end repeat
> end mouseUp
>
> I tried it here and it seems to work fine.
>
> You could also skip the scrolling field and put the data into an 
> external text file.
>
> Best Regards,
>
> Tim Ponn
>
>
>
> Paul Charlesworth wrote:
>
>> Dear All:
>>
>> I am working on my first ever programming project, a simple periodic 
>> table, and have created the interface using colored buttons. At the 
>> bottom of the screen I have an area with elemental properties. This 
>> is basically a Tab area (for future options) and a series of fields 
>> for each property.
>>
>> What I would like to know is the most elegant beginners way to script 
>> the placement of properties into each field on pressing an element 
>> button. At this point I am adding the following script to each >> button:
>>
>> on mouseup
>>   put "Hydrogen" into field "ElementNameField"
>>   put "1" into field "AtomicNumberField"
>>   put "1.008" into field "AtomicMassField"
>>   put "37" into field "AtomicRadiusField"
>>   put "N/A" into field "IonicRadiusField"
>>   put "1" into field "OxidationStatesField"
>>   put "gas" into field "StateField"
>>   put "8.9E-5" into field "DensityField"
>>   put "-259" into field "MeltingPointField"
>>   put "-253" into field "BoilingPointField"
>>   put "0.12" into field "HeatFusionField"
>>   put "0.90" into field "HeatVapField"
>>   put "14.90" into field "SpecificHeatField"
>>   put "0.002" into field "ThermalCondField"
>>   put "13.60" into field "IonizationEnergyField"
>>   put "0.75" into field "ElectronAffinityField"
>>   put "2.2" into field "ElectronegativityField"
>>   put "1400" into field "AbundanceField"
>> end mouseup
>>
>>
>> It works great, but I hoping to learn if there was a better way that 
>> might improve speed or save file size. My next questions will 
>> probably be about icons, about boxes, building, and distribution.
>>
>> Many thanks,
>>
>> Paul
>>
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>
>>
>
>
> _______________________________________________
> 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