New Page 1

How To Do - Example Projects

Click on the title to open the example project
Click on the How to projects above to see the basic sample code to help you create your projects quickly and efficiently.
Each "How To" has a overall description as well as a basic line by line detail of code.
You can download the project or copy the menu file to clipboard
 
Basic Entities     Basic animation     Basic functions  
Add Image   Create button   Basic math operations
Draw colour boxes   Show page - multiple pages   Math functions
Draw colour lines   Flashing text message   Create random number
Draw colour vectors   Animation with pointers   Plus and Minus
Draw colour circles   Scroll text message   Show and format Time and Date
Draw colour ellipses   Move images (TouchX, TouchY)   Save Timestamp to text file  
Draw arcs (ellipses with angle)   Move images with buttons   Password Entry Lock  
Add multiple rows text     Move images (press button)     Menu Selection  
Use pointers   Create slider      
Text Hello World   Show and hide entities   Graphs
Create Dynamic Entities     Dial needle   Create X-Bar Graph
      PNG Transparency     Create Y-Bar Graph  
Interfaces and Hardware             Trace graph from array  
Create IO Counter           Draw sinusoid graph   
External Key             Draw graph - DNA style
Use A to D converters           Draw line graph  
Send and receive data - RS232          
Keyboard Control            
           
 

How to do - Plus and Minus

Add background image to library

Create a style for page with the image as background
Create a style for the text entity - font Ascii16, color black
Create a style for the box col=black and back=\\4000000,
Define variable "Value".

Define a page named "pageName" with style "pageStyle"
Create text entity to show Value variable
Create Key which runs MinusF when pressed using TOUCHR style
Create Box used for minus key
Create Text Entity to show "-" symbol

Create Key which runs PlusF when pressed using TOUCHR style
Create Box used for plus key
Create Text Entity to show "+" symbol

Create PlusF function which checks if Value < 100 if it is it adds 1 to Value and then refreshes page with new Value in text entity "ValueText"

Create MinusF function which checks if Value > 0 if it is it minus 1 to Value and then refreshes page with new Value in text entity "ValueText"

After loading show the page named "pageName"


LIB(background,"SDHC/bground.png");

STYLE(pageStyle, Page){image=background;}
STYLE(textStyle, Text){font=Ascii16;col=Black;}
STYLE(drawStyle,Draw){type=B;col=Black;back=\\40000000;}
VAR(Value,50,U8);

PAGE(pageName, pageStyle)
{
TEXT(ValueText,Value,textStyle,240,136);
KEY(KeyM,MinusF,60,60,TOUCHR,120,136);
DRAW(boxM,60,60,drawStyle,120,136);
TEXT(TextM,"-",textStyle,120,136);
KEY(KeyP,PlusF,60,60,TOUCHR,360,136);
DRAW(boxP,60,60,drawStyle,360,136);
TEXT(TextP,"+",textStyle,360,136);
}
FUNC(PlusF)
{
IF(Value<100?[CALC(Value,Value,1,"+");TEXT(ValueText,Value);;]);
}
FUNC(MinusF)
{
IF(Value>0?[CALC(Value,Value,1,"-");TEXT(ValueText,Value);;]);
}
SHOW(pageName);