SlideShare una empresa de Scribd logo
1 de 12
Descargar para leer sin conexión
Calculator
Day 5 :
More Variables
Create It With
in cooperation with
1
As you have seen in the last few days. We have been a heavy user of
variables. We have used local variables in the card and commands.
Since we only have one card, we have not had the chance to use
global variables.
We are almost done with our calculator, so we are going to do a quick
review of how we used variables to be extra sure everyone
understands. Then we are going to use variable to do a super cool
effect used by the calculator.
Hello World App
More
Variables
2
Calculator App
The first variable we will cover is the local
card script variable. Again we are using
the numberPressed command, and we
can see the iNewNumber is used in 2 ways
1. Read - You can use it anywhere in
the card script for validation or
calculations.
2. Write - Sometime you will need to
set a new value to the variable
Local - Card
on mouseUp
numberPressed the label of target
end mouseUp
on numberPressed pNumPress
if lNewNumber = true then
---just set the Display to the number pressed
put pNumPress into field "display"
put false into lNewNumber --Not a new Num anymore
else
---add the pressed number to the display
put pNumPress after field "display"
End if
end numberPressed
You will also see a “l” in front, this will
indicate to you that it is a local card
variable. 3
Calculator App
Local - Command
on equalsPressed
--get out if no currentOperator, nothing to calculate
if lCurrentOperator is empty then exit equalsPressed
put field "display" into tCurrentValue
switch lCurrentOperator
case "/"
put lCurrentTotal / tCurrentValue into lCurrentTotal
break
case "x"
put lCurrentTotal * tCurrentValue into lCurrentTotal
break
case "-"
put lCurrentTotal - tCurrentValue into lCurrentTotal
break
case "+"
put lCurrentTotal + tCurrentValue into lCurrentTotal
break
end switch
put lCurrentTotal into field "display"
end equalsPressed
Next is the local command variable. When
you need to ONLY use the variable within
the current command
1. Write - You will need to set a new
value to the local variable so as to use
it.
2. Read - Then you will be able to use
the value in calculations, to control
logic flow or do validations.
You will also see a “t” in front, this will
indicate to you that it is a temporary or
local command variable. 4
Calculator App
The next variable we cover will be passed
parameter of commands. I have included
the numberPressed code.
1. when the user pressed a number,
that number is passed to the
numberPressed command as a
parameter.
2. LiveCode actually takes the
parameters, and presents them to
you as a local variable.
Parameters
on mouseUp
numberPressed the label of target
end mouseUp
on numberPressed pNumPress
if lNewNumber = true then
---just set the Display to the number pressed
put pNumPress into field "display"
put false into lNewNumber --Not a new Num anymore
else
---add the pressed number to the display
put pNumPress after field "display"
End if
end numberPressed
1
2
You will also see a “p” in front, this will
indicate to you that it is a passed or
parameter variable. 5
Calculator App
Let see how to use local Command
variables to do something super cool. The
Calculator App will dynamically shrink the
font size of the display to fit in as much of
the number as it can.
1. With just a few numbers and lots of
extra space, the font size is 62. That
is our desired size.
2. But in order to allow more numbers in
the display, we need to shrink the
font size to a minimum of say 5.
Just One more Thing!
1 2
LiveCode is a VERY simple, yet powerful
language and we are going to show you
how to do this...
6
Calculator App
Let’s create a new command - textChanged.
Here will we will check and change the size of
the font in order to fit our number in the
display. To get this we use formattedWidth,
which give us what size the field should be
given the font size.
1. Add 2 lines to code that will give us the
formattedWidth vs width of the display.
2. Add the command to the bottom of the
numberPressed command. Click Apply,
run the App. After you have pressed
several numbers, you will start to see the
difference between the numbers.
formattedWidth
on textChanged
answer the formattedWidth of field "display"
answer the width of field "display"
end textChanged
on numberPressed pNumPress
...
--Allow the clearing of the Current value
--by setting the clear button to "C"
set the label of button "clear" to "C"
--Size Display to fit
textChanged
end numberPressed
1
2
7
Calculator App
Start off by adding 2 local
variables that will hold our Min
text size and our Desired text size.
1. Notice that our variables
start with values. You can
change them if you wish.
2. Here is a little logic that will
check if the numbers have
become too large. If so, it
will decrease the font size of
the tDesiredTextSize by 10.
Setting the Min and Desired
Text Size Variables
on textChanged
local tMinTextSize = 5
local tDesiredTextSize = 62
---First, we use the formattedWidth property to see if the display is too large
if the formattedWidth of field "display" >= the width of field "display" then
put (tDesiredTextSize - 10) into tNewTextSize
set the textSize of field "display" to tNewTextSize
end if
end textChanged
1
2
Problem: You can’t just put in any number like 10, you need the proper calculated size.
8
Calculator App
You can see how to utilize local
variables to hold calculated values
and make your code easier to
read and understand.
1. Use [effective textSize] to
get the MOST real size
possible
2. Then put whichever is bigger
tEffectiveSize or
tMinTextSize into tSize
3. Then get whichever is
smaller tSize or
tDesiredTextSize
Get the
tNewText Size
on textChanged
local tMinTextSize = 5
local tDesiredTextSize = 62
---First, we use the formattedWidth property to see if the display is too large
if the formattedWidth of field "display" >= the width of field "display" then
---Calculate the most effective size
put effective textSize of field "display" - 1 into tEffectiveSize
put max(tEffectiveSize, tMinTextSize) into tSize
put min(tSize, tDesiredTextSize) into tNewTextSize
set the textSize of field "display" to tNewTextSize
end if
end textChanged
1
2
3
9
Calculator App Final Version
10
local tMinTextSize = 5
local tDesiredTextSize = 62
on textChanged
repeat while the formattedWidth of field "display" >= the width of field "display" - (item 1 of the margins of field "display" * 2)
--Calculate the most effective size
put the effective textSize of field "display" - 1 into tEffectiveSize
--Get the larger Min or tEffectiveSize
put max(tEffectiveSize, tMinTextSize) into tSize
--Get the smaller tSize or tDesiredTextSize
put min(tSize, tDesiredTextSize) into tNewTextSize
set the textSize of field "display" to tNewTextSize
if the textSize of field "display" = tMinTextSize then exit repeat
end repeat
repeat while the formattedWidth of field "display"< the width of field "display" - (item 1 of the margins of field "display" * 2)
--This line of code is similar in functionality except it enlarges the font size
set the textSize of field "display" to min (max ((the effective textSize of field "display" + 1), tMinTextSize) ,tDesiredTextSize)
if the textSize of field "display" = tDesiredTextSize then exit repeat
end repeat
end textChanged
Calculator App Compare
11
local tMinTextSize = 5
local tDesiredTextSize = 62
on textChanged
repeat while the formattedWidth of field "display" >= the width of field "display" - (item 1 of the margins of field "display" * 2)
--Calculate the most effective size
put the effective textSize of field "display" - 1 into tEffectiveSize
--Get the larger Min or tEffectiveSize
put max(tEffectiveSize, tMinTextSize) into tSize
--Get the smaller tSize or tDesiredTextSize
put min(tSize, sDesiredTextSize) into tNewTextSize
set the textSize of field "display" to tNewTextSize
if the textSize of field "display" = tMinTextSize then exit repeat
end repeat
repeat while the formattedWidth of field "display"< the width of field "display" - (item 1 of the margins of field "display" * 2)
--This line of code is similar in functionality except it enlarges the font size
set the textSize of field "display" to min (max ((the effective textSize of field "display" + 1), sMinTextSize),tDesiredTextSize)
if the textSize of field "display" = tDesiredTextSize then exit repeat
end repeat
end textChanged
If you wish to learn more… Visit LiveCode
Congrats on completing:
More Variables
Don’t forget to save your LiveCode Project!
Calculator App
12

Más contenido relacionado

La actualidad más candente

Lesson 15 Using What If Analysis
Lesson 15   Using What If AnalysisLesson 15   Using What If Analysis
Lesson 15 Using What If Analysisguevarra_2000
 
3 Excel Tools That Help You Perform a What-If Analysis
3 Excel Tools That Help You Perform a What-If Analysis3 Excel Tools That Help You Perform a What-If Analysis
3 Excel Tools That Help You Perform a What-If AnalysisHanapin Marketing
 
Theatre Booking System Lesson 3
Theatre Booking System   Lesson 3Theatre Booking System   Lesson 3
Theatre Booking System Lesson 3mrbelshaw
 
PIVOT ANIMATOR - USER GUIDE - VIDEO EDITING AND MAKING SOFTWARE
PIVOT ANIMATOR - USER GUIDE - VIDEO EDITING AND MAKING SOFTWARE PIVOT ANIMATOR - USER GUIDE - VIDEO EDITING AND MAKING SOFTWARE
PIVOT ANIMATOR - USER GUIDE - VIDEO EDITING AND MAKING SOFTWARE MUHAMMAD HUZAIFA CHAUDHARY
 
Excel Presentation
Excel PresentationExcel Presentation
Excel PresentationBizzyb09
 
Excel Presentation
Excel PresentationExcel Presentation
Excel PresentationBizzyb09
 
Loop structures chpt_6
Loop structures chpt_6Loop structures chpt_6
Loop structures chpt_6cmontanez
 
Please look at the problems I am having which are listed below: Write a prog...
Please look at the problems I am having which are listed below:  Write a prog...Please look at the problems I am having which are listed below:  Write a prog...
Please look at the problems I am having which are listed below: Write a prog...licservernoida
 

La actualidad más candente (10)

Lesson 15 Using What If Analysis
Lesson 15   Using What If AnalysisLesson 15   Using What If Analysis
Lesson 15 Using What If Analysis
 
3 Excel Tools That Help You Perform a What-If Analysis
3 Excel Tools That Help You Perform a What-If Analysis3 Excel Tools That Help You Perform a What-If Analysis
3 Excel Tools That Help You Perform a What-If Analysis
 
Theatre Booking System Lesson 3
Theatre Booking System   Lesson 3Theatre Booking System   Lesson 3
Theatre Booking System Lesson 3
 
PIVOT ANIMATOR - USER GUIDE - VIDEO EDITING AND MAKING SOFTWARE
PIVOT ANIMATOR - USER GUIDE - VIDEO EDITING AND MAKING SOFTWARE PIVOT ANIMATOR - USER GUIDE - VIDEO EDITING AND MAKING SOFTWARE
PIVOT ANIMATOR - USER GUIDE - VIDEO EDITING AND MAKING SOFTWARE
 
Excel Presentation
Excel PresentationExcel Presentation
Excel Presentation
 
Excel Presentation
Excel PresentationExcel Presentation
Excel Presentation
 
Loop structures chpt_6
Loop structures chpt_6Loop structures chpt_6
Loop structures chpt_6
 
Print9
Print9Print9
Print9
 
Please look at the problems I am having which are listed below: Write a prog...
Please look at the problems I am having which are listed below:  Write a prog...Please look at the problems I am having which are listed below:  Write a prog...
Please look at the problems I am having which are listed below: Write a prog...
 
Ms Excel 4th
Ms Excel 4thMs Excel 4th
Ms Excel 4th
 

Similar a Calculator 5

Practicalfileofvb workshop
Practicalfileofvb workshopPracticalfileofvb workshop
Practicalfileofvb workshopdhi her
 
Visual Basic Review - ICA
Visual Basic Review - ICAVisual Basic Review - ICA
Visual Basic Review - ICAemtrajano
 
Basic calculator tutorial
Basic calculator tutorialBasic calculator tutorial
Basic calculator tutorialGilkye
 
Python Training in Chandigarh(Mohali)
Python Training in Chandigarh(Mohali)Python Training in Chandigarh(Mohali)
Python Training in Chandigarh(Mohali)ExcellenceAcadmy
 
Python Training Course in Chandigarh(Mohali)
Python Training Course in Chandigarh(Mohali)Python Training Course in Chandigarh(Mohali)
Python Training Course in Chandigarh(Mohali)ExcellenceAcadmy
 
Programming For As Comp
Programming For As CompProgramming For As Comp
Programming For As CompDavid Halliday
 
Programming For As Comp
Programming For As CompProgramming For As Comp
Programming For As CompDavid Halliday
 
Cognos TM1 Assignments
Cognos TM1 Assignments Cognos TM1 Assignments
Cognos TM1 Assignments rameshkp054
 
OverviewThis hands-on lab allows you to follow and experiment w.docx
OverviewThis hands-on lab allows you to follow and experiment w.docxOverviewThis hands-on lab allows you to follow and experiment w.docx
OverviewThis hands-on lab allows you to follow and experiment w.docxgerardkortney
 
Lecture#2 Computer languages computer system and Programming EC-105
Lecture#2 Computer languages computer system and Programming EC-105Lecture#2 Computer languages computer system and Programming EC-105
Lecture#2 Computer languages computer system and Programming EC-105NUST Stuff
 
Visual Programming
Visual ProgrammingVisual Programming
Visual ProgrammingBagzzz
 
Tutorial basic of c ++lesson 1 eng ver
Tutorial basic of c ++lesson 1 eng verTutorial basic of c ++lesson 1 eng ver
Tutorial basic of c ++lesson 1 eng verQrembiezs Intruder
 
Enrich enriching mathematics conversi biner 16 pada sisikomputerize indoensia...
Enrich enriching mathematics conversi biner 16 pada sisikomputerize indoensia...Enrich enriching mathematics conversi biner 16 pada sisikomputerize indoensia...
Enrich enriching mathematics conversi biner 16 pada sisikomputerize indoensia...Dadangsachir WANDA ir.mba
 
Chapter 1
Chapter 1Chapter 1
Chapter 1Pieaugt
 
Android tutorials7 calulator_improve
Android tutorials7 calulator_improveAndroid tutorials7 calulator_improve
Android tutorials7 calulator_improveVlad Kolesnyk
 

Similar a Calculator 5 (20)

Practicalfileofvb workshop
Practicalfileofvb workshopPracticalfileofvb workshop
Practicalfileofvb workshop
 
Visual Basic Review - ICA
Visual Basic Review - ICAVisual Basic Review - ICA
Visual Basic Review - ICA
 
C++ Homework Help
C++ Homework HelpC++ Homework Help
C++ Homework Help
 
Basic calculator tutorial
Basic calculator tutorialBasic calculator tutorial
Basic calculator tutorial
 
Python Training in Chandigarh(Mohali)
Python Training in Chandigarh(Mohali)Python Training in Chandigarh(Mohali)
Python Training in Chandigarh(Mohali)
 
Python Training Course in Chandigarh(Mohali)
Python Training Course in Chandigarh(Mohali)Python Training Course in Chandigarh(Mohali)
Python Training Course in Chandigarh(Mohali)
 
Programming For As Comp
Programming For As CompProgramming For As Comp
Programming For As Comp
 
Programming For As Comp
Programming For As CompProgramming For As Comp
Programming For As Comp
 
Introduction to Procedural Programming in C++
Introduction to Procedural Programming in C++Introduction to Procedural Programming in C++
Introduction to Procedural Programming in C++
 
Cognos TM1 Assignments
Cognos TM1 Assignments Cognos TM1 Assignments
Cognos TM1 Assignments
 
Chapter 2- Prog101.ppt
Chapter 2- Prog101.pptChapter 2- Prog101.ppt
Chapter 2- Prog101.ppt
 
OverviewThis hands-on lab allows you to follow and experiment w.docx
OverviewThis hands-on lab allows you to follow and experiment w.docxOverviewThis hands-on lab allows you to follow and experiment w.docx
OverviewThis hands-on lab allows you to follow and experiment w.docx
 
Lecture#2 Computer languages computer system and Programming EC-105
Lecture#2 Computer languages computer system and Programming EC-105Lecture#2 Computer languages computer system and Programming EC-105
Lecture#2 Computer languages computer system and Programming EC-105
 
C# simplified
C#  simplifiedC#  simplified
C# simplified
 
Visual Programming
Visual ProgrammingVisual Programming
Visual Programming
 
Tutorial basic of c ++lesson 1 eng ver
Tutorial basic of c ++lesson 1 eng verTutorial basic of c ++lesson 1 eng ver
Tutorial basic of c ++lesson 1 eng ver
 
Enrich enriching mathematics conversi biner 16 pada sisikomputerize indoensia...
Enrich enriching mathematics conversi biner 16 pada sisikomputerize indoensia...Enrich enriching mathematics conversi biner 16 pada sisikomputerize indoensia...
Enrich enriching mathematics conversi biner 16 pada sisikomputerize indoensia...
 
Chapter 1
Chapter 1Chapter 1
Chapter 1
 
Chapter - 6.pptx
Chapter - 6.pptxChapter - 6.pptx
Chapter - 6.pptx
 
Android tutorials7 calulator_improve
Android tutorials7 calulator_improveAndroid tutorials7 calulator_improve
Android tutorials7 calulator_improve
 

Más de livecode

Empower individuals with autism through coding
Empower individuals with autism through codingEmpower individuals with autism through coding
Empower individuals with autism through codinglivecode
 
LiveCode resources
LiveCode resourcesLiveCode resources
LiveCode resourceslivecode
 
The LiveCode Cloud
The LiveCode CloudThe LiveCode Cloud
The LiveCode Cloudlivecode
 
Business & Tech Matters in the App Business
Business & Tech Matters in the App BusinessBusiness & Tech Matters in the App Business
Business & Tech Matters in the App Businesslivecode
 
Digital Pomegranate
Digital PomegranateDigital Pomegranate
Digital Pomegranatelivecode
 
Increase App Downloads and Revenue with App Localization and LiveCode 7
Increase App Downloads and Revenue with App Localization and LiveCode 7Increase App Downloads and Revenue with App Localization and LiveCode 7
Increase App Downloads and Revenue with App Localization and LiveCode 7livecode
 

Más de livecode (6)

Empower individuals with autism through coding
Empower individuals with autism through codingEmpower individuals with autism through coding
Empower individuals with autism through coding
 
LiveCode resources
LiveCode resourcesLiveCode resources
LiveCode resources
 
The LiveCode Cloud
The LiveCode CloudThe LiveCode Cloud
The LiveCode Cloud
 
Business & Tech Matters in the App Business
Business & Tech Matters in the App BusinessBusiness & Tech Matters in the App Business
Business & Tech Matters in the App Business
 
Digital Pomegranate
Digital PomegranateDigital Pomegranate
Digital Pomegranate
 
Increase App Downloads and Revenue with App Localization and LiveCode 7
Increase App Downloads and Revenue with App Localization and LiveCode 7Increase App Downloads and Revenue with App Localization and LiveCode 7
Increase App Downloads and Revenue with App Localization and LiveCode 7
 

Calculator 5

  • 1. Calculator Day 5 : More Variables Create It With in cooperation with 1
  • 2. As you have seen in the last few days. We have been a heavy user of variables. We have used local variables in the card and commands. Since we only have one card, we have not had the chance to use global variables. We are almost done with our calculator, so we are going to do a quick review of how we used variables to be extra sure everyone understands. Then we are going to use variable to do a super cool effect used by the calculator. Hello World App More Variables 2
  • 3. Calculator App The first variable we will cover is the local card script variable. Again we are using the numberPressed command, and we can see the iNewNumber is used in 2 ways 1. Read - You can use it anywhere in the card script for validation or calculations. 2. Write - Sometime you will need to set a new value to the variable Local - Card on mouseUp numberPressed the label of target end mouseUp on numberPressed pNumPress if lNewNumber = true then ---just set the Display to the number pressed put pNumPress into field "display" put false into lNewNumber --Not a new Num anymore else ---add the pressed number to the display put pNumPress after field "display" End if end numberPressed You will also see a “l” in front, this will indicate to you that it is a local card variable. 3
  • 4. Calculator App Local - Command on equalsPressed --get out if no currentOperator, nothing to calculate if lCurrentOperator is empty then exit equalsPressed put field "display" into tCurrentValue switch lCurrentOperator case "/" put lCurrentTotal / tCurrentValue into lCurrentTotal break case "x" put lCurrentTotal * tCurrentValue into lCurrentTotal break case "-" put lCurrentTotal - tCurrentValue into lCurrentTotal break case "+" put lCurrentTotal + tCurrentValue into lCurrentTotal break end switch put lCurrentTotal into field "display" end equalsPressed Next is the local command variable. When you need to ONLY use the variable within the current command 1. Write - You will need to set a new value to the local variable so as to use it. 2. Read - Then you will be able to use the value in calculations, to control logic flow or do validations. You will also see a “t” in front, this will indicate to you that it is a temporary or local command variable. 4
  • 5. Calculator App The next variable we cover will be passed parameter of commands. I have included the numberPressed code. 1. when the user pressed a number, that number is passed to the numberPressed command as a parameter. 2. LiveCode actually takes the parameters, and presents them to you as a local variable. Parameters on mouseUp numberPressed the label of target end mouseUp on numberPressed pNumPress if lNewNumber = true then ---just set the Display to the number pressed put pNumPress into field "display" put false into lNewNumber --Not a new Num anymore else ---add the pressed number to the display put pNumPress after field "display" End if end numberPressed 1 2 You will also see a “p” in front, this will indicate to you that it is a passed or parameter variable. 5
  • 6. Calculator App Let see how to use local Command variables to do something super cool. The Calculator App will dynamically shrink the font size of the display to fit in as much of the number as it can. 1. With just a few numbers and lots of extra space, the font size is 62. That is our desired size. 2. But in order to allow more numbers in the display, we need to shrink the font size to a minimum of say 5. Just One more Thing! 1 2 LiveCode is a VERY simple, yet powerful language and we are going to show you how to do this... 6
  • 7. Calculator App Let’s create a new command - textChanged. Here will we will check and change the size of the font in order to fit our number in the display. To get this we use formattedWidth, which give us what size the field should be given the font size. 1. Add 2 lines to code that will give us the formattedWidth vs width of the display. 2. Add the command to the bottom of the numberPressed command. Click Apply, run the App. After you have pressed several numbers, you will start to see the difference between the numbers. formattedWidth on textChanged answer the formattedWidth of field "display" answer the width of field "display" end textChanged on numberPressed pNumPress ... --Allow the clearing of the Current value --by setting the clear button to "C" set the label of button "clear" to "C" --Size Display to fit textChanged end numberPressed 1 2 7
  • 8. Calculator App Start off by adding 2 local variables that will hold our Min text size and our Desired text size. 1. Notice that our variables start with values. You can change them if you wish. 2. Here is a little logic that will check if the numbers have become too large. If so, it will decrease the font size of the tDesiredTextSize by 10. Setting the Min and Desired Text Size Variables on textChanged local tMinTextSize = 5 local tDesiredTextSize = 62 ---First, we use the formattedWidth property to see if the display is too large if the formattedWidth of field "display" >= the width of field "display" then put (tDesiredTextSize - 10) into tNewTextSize set the textSize of field "display" to tNewTextSize end if end textChanged 1 2 Problem: You can’t just put in any number like 10, you need the proper calculated size. 8
  • 9. Calculator App You can see how to utilize local variables to hold calculated values and make your code easier to read and understand. 1. Use [effective textSize] to get the MOST real size possible 2. Then put whichever is bigger tEffectiveSize or tMinTextSize into tSize 3. Then get whichever is smaller tSize or tDesiredTextSize Get the tNewText Size on textChanged local tMinTextSize = 5 local tDesiredTextSize = 62 ---First, we use the formattedWidth property to see if the display is too large if the formattedWidth of field "display" >= the width of field "display" then ---Calculate the most effective size put effective textSize of field "display" - 1 into tEffectiveSize put max(tEffectiveSize, tMinTextSize) into tSize put min(tSize, tDesiredTextSize) into tNewTextSize set the textSize of field "display" to tNewTextSize end if end textChanged 1 2 3 9
  • 10. Calculator App Final Version 10 local tMinTextSize = 5 local tDesiredTextSize = 62 on textChanged repeat while the formattedWidth of field "display" >= the width of field "display" - (item 1 of the margins of field "display" * 2) --Calculate the most effective size put the effective textSize of field "display" - 1 into tEffectiveSize --Get the larger Min or tEffectiveSize put max(tEffectiveSize, tMinTextSize) into tSize --Get the smaller tSize or tDesiredTextSize put min(tSize, tDesiredTextSize) into tNewTextSize set the textSize of field "display" to tNewTextSize if the textSize of field "display" = tMinTextSize then exit repeat end repeat repeat while the formattedWidth of field "display"< the width of field "display" - (item 1 of the margins of field "display" * 2) --This line of code is similar in functionality except it enlarges the font size set the textSize of field "display" to min (max ((the effective textSize of field "display" + 1), tMinTextSize) ,tDesiredTextSize) if the textSize of field "display" = tDesiredTextSize then exit repeat end repeat end textChanged
  • 11. Calculator App Compare 11 local tMinTextSize = 5 local tDesiredTextSize = 62 on textChanged repeat while the formattedWidth of field "display" >= the width of field "display" - (item 1 of the margins of field "display" * 2) --Calculate the most effective size put the effective textSize of field "display" - 1 into tEffectiveSize --Get the larger Min or tEffectiveSize put max(tEffectiveSize, tMinTextSize) into tSize --Get the smaller tSize or tDesiredTextSize put min(tSize, sDesiredTextSize) into tNewTextSize set the textSize of field "display" to tNewTextSize if the textSize of field "display" = tMinTextSize then exit repeat end repeat repeat while the formattedWidth of field "display"< the width of field "display" - (item 1 of the margins of field "display" * 2) --This line of code is similar in functionality except it enlarges the font size set the textSize of field "display" to min (max ((the effective textSize of field "display" + 1), sMinTextSize),tDesiredTextSize) if the textSize of field "display" = tDesiredTextSize then exit repeat end repeat end textChanged
  • 12. If you wish to learn more… Visit LiveCode Congrats on completing: More Variables Don’t forget to save your LiveCode Project! Calculator App 12