SlideShare a Scribd company logo
1 of 20
Download to read offline
Calculator
Day 1 :
Building User Interface
Create It With
in cooperation with
1
Select New
Mainstack from
the File menu.
Just like in our “Hello World” App,
you start by selecting “New
Mainstack” in the Edit Menu.
Calculator App
Starting our next
App: Calculator
2
We will go into details about screen sized
and the multi device market for the mobile
market today.
For now, we are going to standardize on
667 height and 375 width for our stack size
for all of the Apps we will create.
Calculator App
Setting the Stack Size
for Mobile Devices
667
375
Paint Code
They have a complete description of the
different iPhone sizes and an explanation.
Read More
3
Again, we start building our App
by adding controls to the card.
For the Calculator App we will
start with buttons.
But this time, as you can see, we
are going to need 19 of them.
We will also need to change the
“look & feel” of the buttons to
match the Calculator App
design.
Calculator App
Starting our next
App: Calculator
4
Let’s start by adding 4 buttons to our
card. Then use the mouse pointer to
select all 4 buttons.
When you select more than one object
you will see that the Align Object section
of the Property Inspector.
You can also hold down the SHIFT key
and click each button you want
included.
Calculator App
Start building the
User interface
5
To get the controls aligned together one
at a time, but LiveCode makes it quite
easy for you.
There is a quick way to align controls to
the left, right, top, bottom, center and
middle. You can make widths equal or
heights equal.
Please try out all the features to
thoroughly understand object
alignments.
Calculator App
Setting Control
Alignment
6
You will see there is full functionality to
make your user interface just as you
want it. Try it out! Trying it yourself is
important for the learning process.
We have measured the button sized and
the numbers that work best are 90
width and 110 height.
You can just type the numbers in the
Height and Width text box on the
property inspector.
Calculator App
Size & Position the
Controls
7
Just like the last lesson, we are selecting
a group of controls and using the copy
and paste method populate the UI with
controls.
Not only is it easier, but I don’t have to
set the size again.
Calculator App
Copy + Paste
Controls
8
Now let’s turn off Three D, Border and
Hilite border for all buttons. This will keep
the buttons to the simple new “flat” look.
You can see there are a lot of features to set
such as an icon for your button. These are
really very important and we will explore
them soon. Let’s just keep to the basics for
now.
Calculator App
Icons & Border of
Buttons
9
Setting the colors will be next, for now choose
the Orange and the dark orange colors.
1. Select the stack and set the Background
color to black.
2. Set the Fill color of the operator buttons
on the right side to match the calculator
app’s orange color.
3. Set the Text color of the buttons to white.
4. Set the Hilited color to dark orange.
Do the same with the other buttons, but
their color is gray.
Please try out all the features and make sure
you understand what they do.
Calculator App
Colors & Patterns
10
Now let’s change our button’s Text
Formatting
1. Select the button(s) you wish to set.
2. Choose Text Formatting on the
Property Inspector.
3. Set the Font to Helvetica Neue Thin
4. Size the text to 48
5. Set the Alignment to Center and the
Margins to 0.
Please do these steps for all the buttons.
Calculator App
3
Text Formatting
1
2
4
5
11
1. Select the bottom left button.
2. Choose Basic Properties Set the Labels
of the number buttons.
3. Set Names & labels buttons as below:
1
2
3
4
Calculator App
Label Name
AC clear
± toggleSign
% percentage
÷ divide
X multiply
- minus
+ plus
= equals
12
As you can see, the background color of
the calculator is black. This can easily be
set in LiveCode.
Calculator App
Set the Background
to Black
1. Select Stack Inspector from the
Object menu.
2. Choose Colors & Patterns on the
Property Inspector.
3. Click the right box on the
Background line.
4. Select the black color in the color
picker.
1
2
3
13
Now we need a text field to display the
results of calculations. For the text field
we also set the Fill color to black and the
Text color to white. Set the font to
Helvetica and the size 52 and the margins
to 15.
You must turn on Lock text to stop text
input. Also turn off Focusable, Three
dimensional and Show border.
Calculator App
Display the Numbers
14
1. Make sure the number display is
selected.
2. Select the Contents option.
3. Set the name to display.
4. Then simply set the content value
to 0 as the default.
Calculator App
1
2
3
4
Display Properties
15
Calculator App
Take for example when one of the
Operators is clicked, you will see the
border get dark because we set the
Hilited text color to darker Orange.
But also in the App you will see that
a black Border remains as an indicator to
remind them of which operator is
selected - giving a better the user
experience.
Q: How do we do that?
A: Code
User Interface is also
about User Interaction
16
Calculator App
If you edit script the “multiply” button and
add in the following code, you will see the
black border appear. Don’t forget to hit
Apply button.
Now add the same code to the other 4
operator buttons. Each one will show the
black border when clicked.
Let’s Set the BorderColor
Property on mouseUp
--Set the border color to Black
set the BorderColor of me to 0,0,0
set the showBorder of me to true
end mouseUp
**BTW - What is me?
Well in LiveCode controls are like people. When you just what to reference yourself, you just
say me. But, a control can ONLY reference itself me in it’s own space.
17
Calculator App
But the border never goes back to orange
when you click on another operator, so
we need to set the code to set the other
buttons to orange. But why would you
copy so much code to every on mouse
up? Answer: you should not
What you should do is “group” the code
into one command. We are going to call
this command “operatorPress” and pass
which button is pressed as a parameter.
Create Your own
Command
on operatorPressed pOperator
set the showBorder of button "/" to false
set the showBorder of button "x" to false
set the showBorder of button "-" to false
set the showBorder of button "+" to false
--Set the border color to Black
set the borderColor of button pOperator to black
set the showBorder of button pOperator to true
end operatorPressed
18
Calculator App
You will need to change the text in each of
the mouseUp script to just one line. The
line is calling our new command and
passing the name of the operator clicked.
Click Apply, switch in run mode...and click
the different buttons to see how the
black border effects the user interface
and experience.
One Line can now
do it all
on mouseUp
operatorPressed the short name of me
end mouseUp
on mouseUp
set the BorderColor of me to black
set the showBorder of me to true
end mouseUp
19
If you wish to learn more… Visit LiveCode
Congrats on completing:
The User Interface
Don’t forget to save your LiveCode Project!
Calculator App
20

More Related Content

What's hot

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
 
IOS Swift language 1st Tutorial
IOS Swift language 1st TutorialIOS Swift language 1st Tutorial
IOS Swift language 1st TutorialHassan A-j
 
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
 
Magazine awr-ims-3
Magazine awr-ims-3Magazine awr-ims-3
Magazine awr-ims-3Sam Sambala
 
Windows 8 tips & tricks
Windows 8 tips & tricksWindows 8 tips & tricks
Windows 8 tips & tricksMukund Trivedi
 
Azure API Management
Azure API ManagementAzure API Management
Azure API ManagementBizTalk360
 

What's hot (13)

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
 
Ms Excel 4th
Ms Excel 4thMs Excel 4th
Ms Excel 4th
 
Print9
Print9Print9
Print9
 
Loop structures chpt_6
Loop structures chpt_6Loop structures chpt_6
Loop structures chpt_6
 
Macros
MacrosMacros
Macros
 
IOS Swift language 1st Tutorial
IOS Swift language 1st TutorialIOS Swift language 1st Tutorial
IOS Swift language 1st Tutorial
 
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...
 
Magazine awr-ims-3
Magazine awr-ims-3Magazine awr-ims-3
Magazine awr-ims-3
 
Windows 8 tips & tricks
Windows 8 tips & tricksWindows 8 tips & tricks
Windows 8 tips & tricks
 
Azure API Management
Azure API ManagementAzure API Management
Azure API Management
 

Similar to Calculator 1

Using Applications in Windows - R.D.Sivakumar
Using Applications in Windows - R.D.SivakumarUsing Applications in Windows - R.D.Sivakumar
Using Applications in Windows - R.D.SivakumarSivakumar R D .
 
05 conexão logo! 0 ba7 com ihm (wincc flexible)
05 conexão logo! 0 ba7 com ihm (wincc flexible)05 conexão logo! 0 ba7 com ihm (wincc flexible)
05 conexão logo! 0 ba7 com ihm (wincc flexible)Marcio Miranda
 
05 conexão logo! 0 ba7 com ihm (wincc flexible)
05 conexão logo! 0 ba7 com ihm (wincc flexible)05 conexão logo! 0 ba7 com ihm (wincc flexible)
05 conexão logo! 0 ba7 com ihm (wincc flexible)confidencial
 
Primavera manual tutorial book
Primavera manual tutorial bookPrimavera manual tutorial book
Primavera manual tutorial bookThomas Britto
 
Primavera manual tutorial book
Primavera manual tutorial bookPrimavera manual tutorial book
Primavera manual tutorial bookThomas Britto
 
04 conex%c3%a3o%20 logo!%200ba7%20com%20ihm
04 conex%c3%a3o%20 logo!%200ba7%20com%20ihm04 conex%c3%a3o%20 logo!%200ba7%20com%20ihm
04 conex%c3%a3o%20 logo!%200ba7%20com%20ihmMarcio Miranda
 
04 conexão logo! 0 ba7 com ihm
04 conexão logo! 0 ba7 com ihm04 conexão logo! 0 ba7 com ihm
04 conexão logo! 0 ba7 com ihmMarcio Miranda
 
04 conexão logo! 0 ba7 com ihm
04 conexão logo! 0 ba7 com ihm04 conexão logo! 0 ba7 com ihm
04 conexão logo! 0 ba7 com ihmconfidencial
 
themes-how-do-i - Transcript.pdf
themes-how-do-i - Transcript.pdfthemes-how-do-i - Transcript.pdf
themes-how-do-i - Transcript.pdfShaiAlmog1
 
U Pointer Detailed Training Manual
U Pointer Detailed Training ManualU Pointer Detailed Training Manual
U Pointer Detailed Training ManualUPointer
 
Intro to Inventor with MugTree
Intro to Inventor with MugTreeIntro to Inventor with MugTree
Intro to Inventor with MugTreekrysia
 
Introduction to programming using Visual Basic 6
Introduction to programming using Visual Basic 6Introduction to programming using Visual Basic 6
Introduction to programming using Visual Basic 6Jeanie Arnoco
 
Mobi kwik,learner workspace guide
Mobi kwik,learner workspace guideMobi kwik,learner workspace guide
Mobi kwik,learner workspace guideWilliam McIntosh
 
Lab view introduction
Lab view introductionLab view introduction
Lab view introductionJakupBerisha2
 
How to create_your_own_android_app
How to create_your_own_android_appHow to create_your_own_android_app
How to create_your_own_android_appCharo Cuart
 

Similar to Calculator 1 (20)

A Primavera Tutorial
A Primavera TutorialA Primavera Tutorial
A Primavera Tutorial
 
Botones
BotonesBotones
Botones
 
Using Applications in Windows - R.D.Sivakumar
Using Applications in Windows - R.D.SivakumarUsing Applications in Windows - R.D.Sivakumar
Using Applications in Windows - R.D.Sivakumar
 
05 conexão logo! 0 ba7 com ihm (wincc flexible)
05 conexão logo! 0 ba7 com ihm (wincc flexible)05 conexão logo! 0 ba7 com ihm (wincc flexible)
05 conexão logo! 0 ba7 com ihm (wincc flexible)
 
05 conexão logo! 0 ba7 com ihm (wincc flexible)
05 conexão logo! 0 ba7 com ihm (wincc flexible)05 conexão logo! 0 ba7 com ihm (wincc flexible)
05 conexão logo! 0 ba7 com ihm (wincc flexible)
 
Primavera manual tutorial book
Primavera manual tutorial bookPrimavera manual tutorial book
Primavera manual tutorial book
 
Primavera manual tutorial book
Primavera manual tutorial bookPrimavera manual tutorial book
Primavera manual tutorial book
 
04 conex%c3%a3o%20 logo!%200ba7%20com%20ihm
04 conex%c3%a3o%20 logo!%200ba7%20com%20ihm04 conex%c3%a3o%20 logo!%200ba7%20com%20ihm
04 conex%c3%a3o%20 logo!%200ba7%20com%20ihm
 
04 conexão logo! 0 ba7 com ihm
04 conexão logo! 0 ba7 com ihm04 conexão logo! 0 ba7 com ihm
04 conexão logo! 0 ba7 com ihm
 
04 conexão logo! 0 ba7 com ihm
04 conexão logo! 0 ba7 com ihm04 conexão logo! 0 ba7 com ihm
04 conexão logo! 0 ba7 com ihm
 
themes-how-do-i - Transcript.pdf
themes-how-do-i - Transcript.pdfthemes-how-do-i - Transcript.pdf
themes-how-do-i - Transcript.pdf
 
Introduction
IntroductionIntroduction
Introduction
 
U Pointer Detailed Training Manual
U Pointer Detailed Training ManualU Pointer Detailed Training Manual
U Pointer Detailed Training Manual
 
Intro to Inventor with MugTree
Intro to Inventor with MugTreeIntro to Inventor with MugTree
Intro to Inventor with MugTree
 
Introduction to programming using Visual Basic 6
Introduction to programming using Visual Basic 6Introduction to programming using Visual Basic 6
Introduction to programming using Visual Basic 6
 
Tutorials2
Tutorials2Tutorials2
Tutorials2
 
Mobi kwik,learner workspace guide
Mobi kwik,learner workspace guideMobi kwik,learner workspace guide
Mobi kwik,learner workspace guide
 
Visual Logic User Guide
Visual Logic User GuideVisual Logic User Guide
Visual Logic User Guide
 
Lab view introduction
Lab view introductionLab view introduction
Lab view introduction
 
How to create_your_own_android_app
How to create_your_own_android_appHow to create_your_own_android_app
How to create_your_own_android_app
 

More from 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
 

More from 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 1

  • 1. Calculator Day 1 : Building User Interface Create It With in cooperation with 1
  • 2. Select New Mainstack from the File menu. Just like in our “Hello World” App, you start by selecting “New Mainstack” in the Edit Menu. Calculator App Starting our next App: Calculator 2
  • 3. We will go into details about screen sized and the multi device market for the mobile market today. For now, we are going to standardize on 667 height and 375 width for our stack size for all of the Apps we will create. Calculator App Setting the Stack Size for Mobile Devices 667 375 Paint Code They have a complete description of the different iPhone sizes and an explanation. Read More 3
  • 4. Again, we start building our App by adding controls to the card. For the Calculator App we will start with buttons. But this time, as you can see, we are going to need 19 of them. We will also need to change the “look & feel” of the buttons to match the Calculator App design. Calculator App Starting our next App: Calculator 4
  • 5. Let’s start by adding 4 buttons to our card. Then use the mouse pointer to select all 4 buttons. When you select more than one object you will see that the Align Object section of the Property Inspector. You can also hold down the SHIFT key and click each button you want included. Calculator App Start building the User interface 5
  • 6. To get the controls aligned together one at a time, but LiveCode makes it quite easy for you. There is a quick way to align controls to the left, right, top, bottom, center and middle. You can make widths equal or heights equal. Please try out all the features to thoroughly understand object alignments. Calculator App Setting Control Alignment 6
  • 7. You will see there is full functionality to make your user interface just as you want it. Try it out! Trying it yourself is important for the learning process. We have measured the button sized and the numbers that work best are 90 width and 110 height. You can just type the numbers in the Height and Width text box on the property inspector. Calculator App Size & Position the Controls 7
  • 8. Just like the last lesson, we are selecting a group of controls and using the copy and paste method populate the UI with controls. Not only is it easier, but I don’t have to set the size again. Calculator App Copy + Paste Controls 8
  • 9. Now let’s turn off Three D, Border and Hilite border for all buttons. This will keep the buttons to the simple new “flat” look. You can see there are a lot of features to set such as an icon for your button. These are really very important and we will explore them soon. Let’s just keep to the basics for now. Calculator App Icons & Border of Buttons 9
  • 10. Setting the colors will be next, for now choose the Orange and the dark orange colors. 1. Select the stack and set the Background color to black. 2. Set the Fill color of the operator buttons on the right side to match the calculator app’s orange color. 3. Set the Text color of the buttons to white. 4. Set the Hilited color to dark orange. Do the same with the other buttons, but their color is gray. Please try out all the features and make sure you understand what they do. Calculator App Colors & Patterns 10
  • 11. Now let’s change our button’s Text Formatting 1. Select the button(s) you wish to set. 2. Choose Text Formatting on the Property Inspector. 3. Set the Font to Helvetica Neue Thin 4. Size the text to 48 5. Set the Alignment to Center and the Margins to 0. Please do these steps for all the buttons. Calculator App 3 Text Formatting 1 2 4 5 11
  • 12. 1. Select the bottom left button. 2. Choose Basic Properties Set the Labels of the number buttons. 3. Set Names & labels buttons as below: 1 2 3 4 Calculator App Label Name AC clear ± toggleSign % percentage ÷ divide X multiply - minus + plus = equals 12
  • 13. As you can see, the background color of the calculator is black. This can easily be set in LiveCode. Calculator App Set the Background to Black 1. Select Stack Inspector from the Object menu. 2. Choose Colors & Patterns on the Property Inspector. 3. Click the right box on the Background line. 4. Select the black color in the color picker. 1 2 3 13
  • 14. Now we need a text field to display the results of calculations. For the text field we also set the Fill color to black and the Text color to white. Set the font to Helvetica and the size 52 and the margins to 15. You must turn on Lock text to stop text input. Also turn off Focusable, Three dimensional and Show border. Calculator App Display the Numbers 14
  • 15. 1. Make sure the number display is selected. 2. Select the Contents option. 3. Set the name to display. 4. Then simply set the content value to 0 as the default. Calculator App 1 2 3 4 Display Properties 15
  • 16. Calculator App Take for example when one of the Operators is clicked, you will see the border get dark because we set the Hilited text color to darker Orange. But also in the App you will see that a black Border remains as an indicator to remind them of which operator is selected - giving a better the user experience. Q: How do we do that? A: Code User Interface is also about User Interaction 16
  • 17. Calculator App If you edit script the “multiply” button and add in the following code, you will see the black border appear. Don’t forget to hit Apply button. Now add the same code to the other 4 operator buttons. Each one will show the black border when clicked. Let’s Set the BorderColor Property on mouseUp --Set the border color to Black set the BorderColor of me to 0,0,0 set the showBorder of me to true end mouseUp **BTW - What is me? Well in LiveCode controls are like people. When you just what to reference yourself, you just say me. But, a control can ONLY reference itself me in it’s own space. 17
  • 18. Calculator App But the border never goes back to orange when you click on another operator, so we need to set the code to set the other buttons to orange. But why would you copy so much code to every on mouse up? Answer: you should not What you should do is “group” the code into one command. We are going to call this command “operatorPress” and pass which button is pressed as a parameter. Create Your own Command on operatorPressed pOperator set the showBorder of button "/" to false set the showBorder of button "x" to false set the showBorder of button "-" to false set the showBorder of button "+" to false --Set the border color to Black set the borderColor of button pOperator to black set the showBorder of button pOperator to true end operatorPressed 18
  • 19. Calculator App You will need to change the text in each of the mouseUp script to just one line. The line is calling our new command and passing the name of the operator clicked. Click Apply, switch in run mode...and click the different buttons to see how the black border effects the user interface and experience. One Line can now do it all on mouseUp operatorPressed the short name of me end mouseUp on mouseUp set the BorderColor of me to black set the showBorder of me to true end mouseUp 19
  • 20. If you wish to learn more… Visit LiveCode Congrats on completing: The User Interface Don’t forget to save your LiveCode Project! Calculator App 20