<JSB> <JSB_DESCRIPTOR name="netscape.peas.Calc4" displayName="Calc4" shortDescription="Calculate a formula based on four input values" ENV="client"> <JSB_PROPERTY NAME="result" DISPLAYNAME="Result" PROPTYPE="JS" TYPE="string" ISBOUND SHORTDESCRIPTION="The resulting calculated value"> <JSB_PROPERTY NAME="in1" DISPLAYNAME="Input 1" PROPTYPE="JS" TYPE="string" WRITEMETHOD="setIn1" DEFAULT_VALUE="value one" SHORTDESCRIPTION="Input string number 1"> <JSB_PROPERTY NAME="in2" DISPLAYNAME="Input 2" PROPTYPE="JS" TYPE="string" WRITEMETHOD="setIn2" DEFAULT_VALUE="value two" SHORTDESCRIPTION="Input string number 2"> <JSB_PROPERTY NAME="in3" DISPLAYNAME="Input 3" PROPTYPE="JS" TYPE="string" WRITEMETHOD="setIn3" DEFAULT_VALUE="value three" SHORTDESCRIPTION="Input string number 3"> <JSB_PROPERTY NAME="in4" DISPLAYNAME="Input 4" PROPTYPE="JS" TYPE="string" WRITEMETHOD="setIn4" DEFAULT_VALUE="value four" SHORTDESCRIPTION="Input string number 4"> <JSB_PROPERTY NAME="formula" DISPLAYNAME="Formula" PROPTYPE="JS" TYPE="string" SHORTDESCRIPTION="This formula will be recalculated every time any input changes"> <JSB_METHOD NAME="setIn1" TYPE="void"> <JSB_PARAMETER name="newin" type="string"> </JSB_METHOD> <JSB_METHOD NAME="setIn2" TYPE="void"> <JSB_PARAMETER name="newin" type="string"> </JSB_METHOD> <JSB_METHOD NAME="setIn3" TYPE="void"> <JSB_PARAMETER name="newin" type="string"> </JSB_METHOD> <JSB_METHOD NAME="setIn4" TYPE="void"> <JSB_PARAMETER name="newin" type="string"> </JSB_METHOD> <JSB_EVENT NAME="onChange" LISTENERMETHODS="onChange" LISTENERTYPE="onChangeListener" EVENTMODEL="JS"> <JSB_CONSTRUCTOR> function netscape_peas_Calc4_setin1( s ) { this.in1 = s this.recalc() } function netscape_peas_Calc4_setin2( s ) { this.in2 = s this.recalc() } function netscape_peas_Calc4_setin3( s ) { this.in3 = s this.recalc() } function netscape_peas_Calc4_setin4( s ) { this.in4 = s this.recalc() } function netscape_peas_Calc4_recalc() { this.result = eval( this.formula ) this.onChange("result", "", this.result) } function netscape_peas_Calc4(params) { this.formula = params.formula this.in1 = params.in1 this.in2 = params.in2 this.in3 = params.in3 this.in4 = params.in4 this.setIn1 = netscape_peas_Calc4_setin1; this.setIn2 = netscape_peas_Calc4_setin2; this.setIn3 = netscape_peas_Calc4_setin3; this.setIn4 = netscape_peas_Calc4_setin4; this.recalc = netscape_peas_Calc4_recalc; this.result = eval( this.formula ) } </JSB_CONSTRUCTOR> </JSB>