How to build a calculator with corona(tutorial)

I wrote a multi part tutorial on how to create a simple math calculator with Corona.
Part 1 covers how to build the keypad with no images, just the native Corona display objects.
It also demonstrates lua classes, external files and simple inheritance. The next parts of the series will be available soon.
Hope it’s helpful to anyone.
Please let me know what you think!
http://www.flemingermedia.com/2012/03/14/create-a-calculator-with-corona-p-1/

EDIT:
part 2:
http://www.flemingermedia.com/2012/03/20/create-a-calculator-with-corona-p-2/
Part 3 completed, with full source code:
http://www.flemingermedia.com/2012/04/02/create-a-calculator-with-corona-p-3/ [import]uid: 33608 topic_id: 23322 reply_id: 323322[/import]

Can you tweet this and add the @ansca #coronaSDK tags so my media PR guy can re-tweet :slight_smile:

thanks

c
[import]uid: 24 topic_id: 23322 reply_id: 93398[/import]

Absolutely,
Thanks! [import]uid: 33608 topic_id: 23322 reply_id: 93404[/import]

Great tutorial! found it very helpful as I’m new to Corona/Lua. Thanks! [import]uid: 132483 topic_id: 23322 reply_id: 93431[/import]

Looks awesome Amir! I hope that this shows up on learningcorona.com - a calculator is a fantastic tutorial as I imagine a lot of people would be interested in making one while learning. [import]uid: 52491 topic_id: 23322 reply_id: 93463[/import]

Thanks everyone. I’m hoping to get the next part out sometime this week or beginning of next week. [import]uid: 33608 topic_id: 23322 reply_id: 93531[/import]

its wonder ful…thganks for your code…still i have doubt that how we can display tha clicked buttons text and do the manipulations??that is if we want to add 1+2 we have to click 1,+,2 and =.then how to write the code for the manipualtion or calculation… [import]uid: 103576 topic_id: 23322 reply_id: 94764[/import]

haii amir…Thanks the link you gave for calculator its very useful…i tried it…actually i want the calculation part…that means how we can receive user inputs and how we can do the arithmatic calculations…please help me [import]uid: 103576 topic_id: 23322 reply_id: 95050[/import]

hai peach… [import]uid: 103576 topic_id: 23322 reply_id: 95053[/import]

It’s been a very busy week, so I apologize for the delay. Part 2 is coming soon. :slight_smile: [import]uid: 33608 topic_id: 23322 reply_id: 95314[/import]

I’m developing a new High School level curriculum that will rely heavily on Corona and this looks like it could work very well with what we’re putting together. Looking forward to part 2! Thanks :slight_smile: [import]uid: 105707 topic_id: 23322 reply_id: 95357[/import]

EHO, that sounds awesome! I wish I’d have that option in high school :slight_smile: [import]uid: 52491 topic_id: 23322 reply_id: 95365[/import]

its k amir…post the remaining as soon as possible u can…where are u from?? [import]uid: 103576 topic_id: 23322 reply_id: 95371[/import]

hai peach…you are an anasca staff??can you help me for doing corona program? [import]uid: 103576 topic_id: 23322 reply_id: 95373[/import]

Yes, am staff - orange badge is staff, gray is licensed developer and blue/white is trial user.

RE helping you with your project, if you have a question you post a thread in the New User forum and me and others will try to answer it and help you with your code, yes. (We do offer one on one help as a part of

Part two is available:
http://www.flemingermedia.com/2012/03/20/create-a-calculator-with-corona-p-2/

Part three of the trilogy is almost ready :slight_smile: [import]uid: 33608 topic_id: 23322 reply_id: 95608[/import]

thnks amir… [import]uid: 103576 topic_id: 23322 reply_id: 95636[/import]

nice to meet u peach…i will post my queries in this forum…i have doubt…in windows i wrote program to create text field for calculator…when running the code terminal shows one warning as “native text fields are not currently supported in the simulator.please build for device”
when in clik any button i shows warning as “keyboard focus is not currently supported in the simulator.please build for device”
my code for text field is

local firstNumber =native.newTextField( 50, 150, 220, 36, handlerFunction )
firstNumber.inputType = “number”
[import]uid: 103576 topic_id: 23322 reply_id: 95639[/import]

Nice to meet you too, Krishna :slight_smile:

I will answer this question here but then switch to making threads in that other forum, OK? I ask this because when we post in this thread others who have posted here also get email notifications and this discussion may not be relevant to them.

The warning you are getting in the simulator is because on Windows the simulator does not show text fields or they keyboard, to see them you should build the app and install it on a device.

Peach :slight_smile: [import]uid: 52491 topic_id: 23322 reply_id: 95670[/import]