How to build Calculator in DroidScript

Calculator build in DroidScript




How to build a Calculator in DroidScript?

This is simple example are to build a Calculator in DroidScript, you can make it in complex mode after work on it for changing and modification. Button design are simple you can colorized and other features you may like to upgrade. So keep smiling on your face but after work on it.


Thanks you for all Reader's.

Audio Player with Recorder version 3.0
Coding Start here ...

//Init variables.
var sum = "";

//Called when application is started.
function OnStart()
{
	//Create a layout with objects vertically centered.
	layMain = app.CreateLayout( "linear", "FillXY" )	

	//Create array to hold number buttons.
	keys = [ 7,8,9,"/", 4,5,6,"*", 1,2,3,"-", 0,".","C","+" ];
	
	//Create text control for displaying sum.
	txtSum = app.CreateText( "", 0.8, 0.1 )
	txtSum.SetTextSize( 42 )
	txtSum.SetBackColor( "#ff222222" )
	txtSum.SetMargins( 0, 0.1, 0, 0.05 )
	layMain.AddChild( txtSum )
	
	//Create first row of buttons.
	lay1st = app.CreateLayout( "linear", "Horizontal" )	
	for( i=0; i<4 0.1="" a="" addbutton="" alculate="" alled="" and="" andle="" app.="" app.addlayout="" app.vibrate="" btn.setontouch="" btn="this;" btns_ontouch="" button.="" button="" buttons.="" calcresult="" catch="" clear="" dd="" display.="" e="" else="" equals="" errors="" et="" fifth="" for="" fourth="" function="" given="" i="" if="" keys="" lay.addchild="" lay1st="" lay2nd="" lay3rd="" lay4th="" lay5th="" lay="" laymain.addchild="" laymain="" layout.="" layout="" linear="" lum="" name="" number="" of="" orizontal="" other="" pdate="" pre="" presses="" reate="" row="" second="" sum.="" sum="Error" text.="" third="" to="" tofixed="" try="" txt="" txtsum.settext="" user="" valuate="" var="" w="" when="">

Post a Comment

0 Comments