Applet
From Pointui
Inherits Control.
Contents |
Overview
An Applet is a control that is displayed within the Applet Ribbon on the home screen. Each applet has a fixed size irrespective of orientation. The user can swipe left and right to move to the previous or next applet in the ribbon.
Each applet must be placed in it’s own folder under the [Home]\AppletRibbon folder. The following structure is required as a minimum to create a new applet that is usable:
- Choose an applet name (e.g. “MyFootballScores”). The name must be unique, so cannot be the same name as any Pointui provided applets and if another developer creates an applet by the same name only one will be usable.
- Create the applet folder on the device - this is a folder to store the applet resources and must be a sub-folder of [Home]\AppletRibbon. For example: [Home]\AppletRibbon\MyFootballScores.
- Create a Pointui C Script file that will contain the applet code. For example: MyFootballScores.cs. The script file must be named using the exact name chosen for the applet – so in this case “MyFootballScores.cs”. If it does not match the applet won’t run.
- Within the script file create a class for the applet that inherits from Applet. Once again, the name of the class is very important – it must be the name of the applet “MyFootballScores” with the word “Applet” appended, so “MyFootballScoresApplet” in this case. The Script Engine specifically looks for such named classes when attempting to run each applet, so if the applet class hasn’t been named correctly it won’t be recognized.
- Copy the script file to the applet folder.
- Restart Home.
- Click on the AI (Applet Indicator) control on the home screen (just below the applets) and add the new applet you have created. If you have followed the steps above correctly then you should be able to see your applet in the list to add. Usually when building and testing an applet it is easier to reorder it (by dragging the applet) to be the first one so each time you restart Home it is displayed immediately.
Methods
void FlagScreenChanged()
Forces the screen to redraw. Typically the screen will know when it needs to redraw based on changes such as setting the text of a Label. However if there is ever a need to force or ensure the screen updates then FlagScreenChanged can be used.
void FlagUpdateRequired()
Flags that the Applet needs to be updated, and will cause it’s Activated() method to be called either immediately if the Applet is visible, or as soon as it’s made visible in future. Often this is used in conjunction with notifications such as from RegistryNotification to ensure the applet is updated when appropriate, but only as necessary. For instance, if you just updated all of the visible controls every time a notification was received whether the applet was visible or not then it would consume unnecessary processing because even all of the non-visible applets would be continually updating for no reason.
void Activated()
Called by the script engine every time the applet is displayed either from the user cycling to this applet or by returning to it after being on another screen, but only once the applet has finished animating to it’s position.
void Deactivated()
Called by the script engine when the applet is losing focus either by navigating to another applet or by branching off to another screen.
void SetTitleMode(String mode)
AVAILABLE SINCE: 2.0.22b Sets the mode of the title bar on the home screen for this applet. It must be one of the following values:
- "Time" - displays the time
- "Date" - displays the date
This only needs to be called once, and is typically done from the Applet's Load() method.
void ShowApplet(String appletID)
AVAILABLE SINCE: 2.1 Allows an applet to set another applet as the focused applet.
void SetStyle(String style)
AVAILABLE SINCE: 2.1 Sets the applet style, and must be one of the following:
- "Normal" - fixed size applet
- "Variable" - variable sized applet that takes as much space as possible without overlapping other controls
- "FullScreen" - (Pro only) like a Variable applet but when focused all controls on the home screen disappear and the applet takes the entire screen
Applet Principles
Improving Performance
Need to provide some tips on how to ensure good performance such as stopping Timer objects in Deactivated() so they don’t keep firing unnecessarily while on other screens.
