A simple calculation

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
AQLIVE
Posts: 4
Joined: Tue Mar 18, 2014 12:12 pm

A simple calculation

Post by AQLIVE » Tue Mar 18, 2014 12:19 pm

How do I implement the following:

A label called currency, an input field, a checkbox for up and a check box for down, and a calculated field.

I then want to input a value, check either up or down checkbox and based on the selected checkbox I want to add (if up selected) 0.00112 to the entered value or -0.00112(if down is selected)

I know it's a lot to ask but if someone could then maybe point me in the right direction.
Thanks in advance.
Attachments
SimpleCalculation.livecode.zip
(958 Bytes) Downloaded 142 times

Klaus
Posts: 14182
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: A simple calculation

Post by Klaus » Tue Mar 18, 2014 2:40 pm

Hi AQLIVE,

1. welcome to the forum! :D

2. I highly recommend to take a look at these stack to get the basics of Livecode:
http://www.hyperactivesw.com/revscriptc ... ences.html

3. Please take a look that the attached stack, should do what wou want.
I commented all scripts, so please take deep look!

Best

Klaus
Attachments
calculation1.livecode.zip
(2.16 KiB) Downloaded 140 times

AQLIVE
Posts: 4
Joined: Tue Mar 18, 2014 12:12 pm

Re: A simple calculation

Post by AQLIVE » Wed Mar 19, 2014 6:59 am

Hi Klaus and thanks you sooooooo much for that detailed explanation of how to do that simple calculation.
That really helped me alot.

I thought functions (the calculation function) should be written in the stack and not in the button.
But this makes it much simpler. Thanks a million :-)

It it possible then to make somekind of executable / program file from that piece of code so that I can just start the calculation program instead of live code every time?

Klaus
Posts: 14182
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: A simple calculation

Post by Klaus » Wed Mar 19, 2014 12:53 pm

Hi AQLIVE;
AQLIVE wrote:I thought functions (the calculation function) should be written in the stack and not in the button.
But this makes it much simpler. Thanks a million :-)
"Commonly used" should of course go into the stack or card script, but this was just a quick example :D
AQLIVE wrote:It it possible then to make somekind of executable / program file from that piece of code ...
Sure it is! :shock:

In Livecode go to menu "Help" and select "User Guide".
Then a PDF should open and in the PDF look for chapter: 9.1 Building a Standalone Application
That will tell you what to do :D


Best

Klaus

Post Reply