PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Overview
  • Creating an Android Widget window
  • Characteristics of Android Widget window
  • Size of a Widget window
  • Update the content
  • Redisplaying the Widget window
  • Image of Widget
  • Programming an Android Widget window
  • Opening a Widget window
  • Closing a Widget window
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Android Widget windows
Overview
An Android application can contain one or more Widget windows. These windows can be displayed on the home screen of tablet or phone.
The information displayed in these windows is updated on a regular basis. The Widgets windows allow simple interactions with the user.

Creating an Android Widget window

To create an Android Widget window:
  1. Click among the quick access buttons:
    • Click "Window" in the wheel that is displayed. The window for creating a new element is displayed: click "Window" then "Window".
    • The wizard for window creation starts.
  2. In the "Standard" tab, select "Blank for Widget" and validate.In the "Standard" tab, in the "Other platform" area, select "Blank for Widget" and validate.
  3. A new window is created in the editor. Only 3 types of controls are available in the Widget windows: the Button controls, the Static controls and the Image controls.
Note: You also have the ability to modify the type of an existing window:
  1. Display the description of the window ("Description" from the popup menu).
  2. In the "Details" tab, select "Widget (Android)".In the "GUI" tab, select "Widget (Android)".
  3. Validate.
Characteristics of Android Widget window

Size of a Widget window

The size of a Widget window is defined in number of vertical and horizontal cells. This size can be configured in the "Details" tab of description window: This size can be configured in the "GUI" tab of description window:
The size of a cell is set to 74 pixels for the side (for a dpi of 160).
For a display compatible with most of the devices (phones and tablets), the maximum size should not exceed 4 x 4 cells.
Note: The Widgets created with WINDEV Mobile cannot be resized.

Update the content

The Widget windows include a specific process: Refreshing the Widget. This process is used to update the Widget content. This process is performed at regular time interval. This interval is defined in the "Details" tab of description window.The refresh frequency is defined in the "GUI" tab of description window.
Notes:
  • This refresh frequency cannot be less than 30 minutes.
  • WidgetDisplay redisplays the Widget and runs the refresh process.

Redisplaying the Widget window

The drawing of a Widget window is displayed by the process that manages the home screen of device. This display is not always performed. It is updated in the following cases:
  • Adding a new instance of the Widget on the home screen.
  • Once a Widget button or image was clicked.
  • Once the Widget content was updated.
Note: WidgetDisplay redisplays the Widget and runs the refresh process.

Image of Widget

When installing a Widget on the desktop, the user can see the list of Widgets found on his computer. This list contains, for each Widget, the Widget name and the preview image.
The preview image of the Widget is defined in the "Details" tab of description window. The preview image of Widget is defined in the "GUI" tab of description window.
You can:
  • provide a specific image.
  • genereate a screen shot of the window. In this case, the screen shot is automatically associated with the preview image.
If no image is specified, the icon of the Android application will be automatically used.
Programming an Android Widget window

Opening a Widget window

You cannot explicitly request the opening of a Widget window. The opening functions (OpenSister, OpenChild, Use) will trigger a fatal error if they are used in Widget mode.
The Widget windows are automatically opened in the following cases :
  • Adding on the home screen the first instance of the Widget corresponding to the window.
  • Once the device is started if at least one instance of the Widget is found on the home screen.
  • When updating the Widget or when the user interacts with the Widget (click on a button for example).
  • If the process was stopped by the system (if it needs resources for example).
The following processes are run when opening a Widget window :
  • Declaring the global variables.
  • Initializing the window controls.
  • Initializing the window.
  • Refreshing the Widget.
The initialization process of the project will be run before opening the first Widget window of the application. In the initialization process of the project, to differentiate between the code specific to the Widgets and the code specific to the application, use InWidgetMode.

Closing a Widget window

You cannot explicitly request the closing of a Widget window. Close will trigger a fatal error if it is used in Widget mode.
The Widget windows are automatically closed when the last instance of the Widget is removed from the home screen.
The "Window closing" process is run when closing a Widget window.
The closing process of the project will be run when the last instance of the application Widget is removed from the home screen and when no other instance is displayed for the other Widgets of the application.
Minimum required version
  • Version 18
Comments
Click [Add] to post a comment