Command PAGE
 
Description Create a  Page or Group of entities. Pages contain entities to be shown on the display plus functions that will run as a background task only on that page. Entities are listed so that they are layered from back to front. Create the style and declare the page before using the SHOW(PageName); command.
 
Syntax/Parameters PAGE(Name,Style)
{
..,//Page Contents
}
 
Style The style defines the page size, position and background.

STYLE(stPage,Page)   //create a style name and define as type Page
 {
 update=all; //define page refresh method with ;; options: 'all' or 'changed'
 sizeX=480; //specify width of page 1 to 3* LCD width     
 sizeY=272; //specify height of page 1 to 3* LCD height
 posX=0;     //specify the absolute X position of page on screen. -4 * LCD width to 4 * LCD width
 posY=0;     //specify the absolute Y position of page on screen. -4 * LCD height to 4 * LCD height
 back=black;  //specify background colour of page as hex \\000000 to \\FFFFFF or colour name
 image=pageimg; //specify background image for the page using the entity name used in the LIB command to store the image .
 }
 
Options Page Refreshing v47.00
A new mode has been added for pages which allows for either:
 - all entities to be redrawn on a page when a double semicolon (
;;) refresh is encountered (default),
 - only the entities that have been modified since last refresh to be redrawn when a double semicolon (
;;) is encountered.

A
SHOW(page); command will always redraw all the entities on a page.
STYLE(name,PAGE) { update=all; } // default: refreshes all entities on a ;;
STYLE(name,PAGE) { update=changed; }
// refreshes only changed entities on a ;;

Page Merging - v37.00
LOAD(Page1,Page2,Page3,…); will copy all entities from Page2 into Page1, then Page3 into Page 1, then Page4 into Page 1.


Pop-Up Pages - v49.03
Page style parameter "type=popUp;" or "type=p;" added to define a page as a pop-up.
Default is "type=normal;" or "type=n;" for non-pop-up page.
This allows pages the same size as the screen to be defined as a pop-up.
Pages smaller than the screen size will still always be declared as pop-ups; the "type" parameter is ignored in this case.


Support for Pages Larger Than Screen Size - v49.43
* Added functionality to support pages defined greater than page size. The posX and posY in the page style can be used to scroll the
page around.
STYLE(stPg,PAGE){sizeX=960;}
LOAD(stPg.posX,-480);; // Show right half of page
* Modified page style so that only sizeX or sizeY needs to be defined (the other size defaults to the screen size). Previously both sizeX
and sizeY needed to be defined to override the default page size.

Order Page Layers PAGE(name){ent1;ent2;...} - v49.46
* Implemented Page re-ordering functionality.
* Use the PAGE(name) command with no style specified.
* The parameters are:
entName; // Specify the entity on the page
entName,action; // Specify the entity plus the action to perform.
* The format and parameters are:
PAGE(pgName)
{
ent0,u; // up - move entity one place forward
ent1,d; // down - move entity one place backward
ent2,f; // first - move entity to the first position (the front)
ent3,l; // last - move entity to the last position (the back)
ent4,b; // below - move entity behind previous entity in list (ent3)
ent5,a; // above - move entity in front of previous entity in list (ent4)
}

The second 'action' parameter is optional, and defaults to 'b' - below with the first one in the list defaulting to 'f', the top.
PAGE(pgName)
{
ent0; // 'f'
ent1; // 'b'
ent2; // 'b'
ent3; // 'b'
}

In the above, ent0 will appear at the top with ent1 behind ent0, ent2 behind ent1, and ent3 behind ent2. Any other entities on the page
will then be shown behind these with their order unchanged.

PAGE(){} reordering parameters now use '=' separator - v49.47
For consistency with STYLE() and SETUP(), the PAGE(){} reordering parameters now support '=' between the parameter name and
parameter type.
PAGE(name)
{
name=f;
name,f;
}

Screen Capture LOAD( SDHC, PAGE ); - v49.51
* Added TFT screen capture to Bitmap file on SD Card.
* Use LOAD(SDHC,PAGE);
* Files are stored in the "SDHC/page/" directory. If it does not exist then it is created.
* Files are stored as "SDHC/page/pagename_num.bmp" where pagename is the name of the page being displayed on the screen and num is an incrementing number. eg if the page "pgTest" is being displayed then the file will be "SDHC/page/pgTest_1.bmp". A second capture would create "SDHC/page/pgTest_2.bmp".
* The stored bitmap takes into account the rotation of the screen.
* If there is enough free memory then a buffer is created and the display memory is copied instantly to the buffer and this is saved to SD card as a bitmap. This prevents screen updates modifying the required screen capture. If there is not enough free memory then the actual display memory is used and copied to SD card as a bitmap.
* Note, due to the large file sizes involved, writing the bitmap to the SD card will take typically 5-7 secs on 3.5", 9-11 secs on 4.3", 23-26 secs 5.7" and 28-32 secs on 7" displays.


Using  update=changed
To gain the faster refreshing, a few rules apply.
1/ Only the screen area where the changed entity is located is redrawn.
2/ The entity is redrawn on top of any existing pixels being displayed in that area.
3/ Entities with transparent backgrounds will show all previous rendering at that location in the transparent area.
4/ Hiding an entity will not produce any visible difference until a full page refresh is performed.

To support the “update=changed;” method.
1/ Do not use images with transparent backgrounds
2/ Specify the “back” colour in the style for text.
3/ To hide an entity, a “masking” image will need to be placed over the entity.
4/ To refresh only the entities on a page that have been modified, use the double semi-colon “;;” refresh method after the last update object, e.g. IMG(imgt1,myimg );;.
5/ To refresh the whole page, use the SHOW( page ); method.

 
Example PAGE(MainPage,stPage)
 {
   POSN( 200, 208 );  KEY( StopKey, StopEvent, 95, 95, TOUCH );    //call function StopEvent
   POSN( 76, 252 ); KEY( SaveKey, SaveEvent, 62, 24, TOUCH );       //call function SaveEvent
   POSN( +80, +0 ); KEY( CalibKey, CalibEvent, 62, 24, TOUCH );       /call function CalibEvent    
   POSN( +80, +0 ); KEY( ClockKey, [Show(Clock);], 62, 24, TOUCH );  //inline code to show clock
 }