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 dynamically create text, draw and keys

Create a library with the background image
Add font file to Library

Create a style for page with the image as background
Create a style for text
Create a style for draws

Create an X posn variable
Create a num variable
Create a Text Entity Name Variable
Create a Text Entity Value Variable
Create a Draw Entity Name Variable
Create a Key Entity Name Variable
Create a Key Entity Value Variable

Create CreateFunc function

Create a loop to run 4 times.
Load VTxtN with Text and loop number
Load VTxtV with Text and loop number
Load VDrawN with Draw and loop number
Load VKeyN with Key and loop number
Load VKeyV with KeyF and loop number
Cursor at X, 136
Create Box called VDrawN
Create Text called VTxtN with text VTxtV
Create Key called VKeyN with function VKeyV
Increase X position by 115
Increase Loop number by 1

Define a page named "pageName" with style "pageStyle"

Run CreateFunc function


Create KeyF1 function that changes textstyle colour red
Create KeyF2 function that changes textstyle colour blue
Create KeyF3 function that changes textstyle colour yellow
Create KeyF4 function that changes textstyle colour lime

After loading show the page named "pageName"

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

STYLE(pageStyle, Page) { image = background; }
STYLE(textStyle,Text) {font=asc_16; col=\\000d55;}
STYLE(drawStyle,Draw) {type=box; col=\\000d55; back=\\80ffffff; width=2;}

VAR(X,62,U16);
VAR(Num,1,U8);
VAR(VTxtN,"",TXT);
VAR(VTxtV,"",TXT);
VAR(VDrawN,"",TXT);
VAR(VKeyN,"",TXT);
VAR(VKeyV,"",TXT);

FUNC(CreateFunc)
{
LOOP(createl,4)
{
LOAD(VTxtN,"Text",Num); LOAD(VTxtV,"Text",Num);
LOAD(VDrawN,"Draw",Num);
LOAD(VKeyN,"Key",Num); LOAD(VKeyV,"KeyF",Num);
POSN(X,136);
DRAW(VDrawN,95,95,drawStyle);
TEXT(VTxtN,VTxtV,textStyle);
KEY(VKeyN,VKeyV,95,95,TOUCH);
CALC(X,X,115,"+");
CALC(Num,Num,1,"+");
}
}

PAGE(pageName, pageStyle)
{
RUN(CreateFunc);
}

FUNC(KeyF1){LOAD(textStyle.col,red);;}
FUNC(KeyF2){LOAD(textStyle.col,blue);;}
FUNC(KeyF3){LOAD(textStyle.col,yellow);;}
FUNC(KeyF4){LOAD(textStyle.col,lime);;}
SHOW(pageName);