Creating a Calculator in Lectora 11
April 10, 2013 12:00 AM
Does anyone know how to create a simple calculator that adds, subtracts, multiplies & divides in Lectora 11?
Thank you,
Discussion (6)
Lectora way:
1. add input field A (variable A)
2. add input field B (variable B)
3. add text field named "Result-Text"
4. add variable named "Result"
5. add button called "Plus" with two actions:
5.1. set variable "Result" to VAR(A) + VAR(B)
5.2. change content of "Result-Text" to variable "Result"
6. repeat step 5 for subtraction, division, multiplication or any other math action
Script way:
1. Add a proper JS calculator from http://plugins.jquery.com/kbw.calculator/ or from http://www.jquery4u.com/plugins/5-jquery-mobile-calculation-calculators/ or anywhere else. Or write your own.
Smart way:
1. Consider this: every Windows, Mac, iOS or Android user already has a great, familiar, convenient calculator app in their computer or tablet.
2. Also consider this: every human being has a cell phone that has a calculator function, even if it's a 15-year old Motorola.
Ok - I can get so far but the results do not end up in the results-text box. I get VAR(A)XVAR(B) - so it is like the connection to the Results Text box needs a code but there seems something missing in the instructions below. Can someone help me figure this out? I need better step by step instructions on how to create a calculation
8 X 2 = 16 - 8 = a entry box from the Test/Survey area and same with the 2
= has the variable to click on the equal - OnMCLkModVAR - Target REsult Type Set Equal to Value VAR(A)XVAR(B)
second action - ONMCLKChange - Target - Results-Text Value - Result
It seems that Result is missing the link - not sure how to get it associated to the end result answer
?????????????
@ssneg 50268 wrote:
Lectora way:
1. add input field A (variable A)
2. add input field B (variable B)
3. add text field named "Result-Text"
4. add variable named "Result"
5. add button called "Plus" with two actions:
5.1. set variable "Result" to VAR(A) + VAR(B)
5.2. change content of "Result-Text" to variable "Result"
6. repeat step 5 for subtraction, division, multiplication or any other math action
Script way:
1. Add a proper JS calculator from http://plugins.jquery.com/kbw.calculator/ or from http://www.jquery4u.com/plugins/5-jquery-mobile-calculation-calculators/ or anywhere else. Or write your own.
Smart way:
1. Consider this: every Windows, Mac, iOS or Android user already has a great, familiar, convenient calculator app in their computer or tablet.
2. Also consider this: every human being has a cell phone that has a calculator function, even if it's a 15-year old Motorola.
Hey Sergey,
I like your responses especially the "Smart Way"! Wait till someone asks how to build a clock...
-kelly
For a multiplication button you'll need a variable for the results of your calculation (e.g. "results"), and a textfield to display the variable
1.
On: Click
Action: Modify variable
Target: results
Type: Set equal to
Value: VAR(Entry_0001) (Insert the correct name of the variable associated with the first entry field)
2.
On: Click
Action: Modify variable
Target: results
Type: Multiply Variable by
Value: VAR(Entry_0002)
3.
On: Click
Action: Change contents
Target: Results Tex Block
Value: results
Tim
Discussions have been disabled for this post