Script Improvement Advice

Marian Petrides mpetrides at earthlink.net
Thu Jun 5 05:26:00 EDT 2003


What I tend to do is put the script in the card and then call the 
routine from the button e.g.


In the button

On mouseup
	DisplayElement
	--this invokes the handler named DisplayElement which is then found in 
the card script
In the card script

On DisplayElement

> --this is the actual handler -- found in the card script

>   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

End DisplayElement

I find it easier to edit card scripts than to go through EVERY button 
each  time I want to make minor changes in the script associated with 
the button

Marian

On Wednesday, June 4, 2003, at 11:23 PM, 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
>




More information about the use-livecode mailing list