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);
|