The (Circle) Scheduler Widget sample application demonstrates how you can manage text objects and image objects to create a complete widget view.
For information on creating the sample application project in the IDE, see Creating Sample Applications.
The following figure illustrates the main screen of the (Circle) Scheduler Widget.
Figure: (Circle) Scheduler Widget screen
The widget displays the tasks for a specific day.
You can create and view the sample application project including the source files in the IDE.
Table: Source files
||This directory contains the image files used in the main.edc file.
||This file contains information and definition of the variables and functions used in the C files, especially in the data.c file.
||This file contains the log tag. It can also contain information and definition of the variables and functions used in the C files.
||This file contains information and definition of the variables and functions used in the C files, especially in the view.c file.
||This file is for the UI and contains style, image, and position of the sample application.
||This directory contains the image files used in the C files.
||This file contains the functions for retrieving and making data for the application.
||This file contains the functions related to the application life-cycle, callback functions, and view control.
||This file contains the functions for implementing the views and handling events.
The view_create() function creates the widget view frame that consists of the window, text parts, and image parts.
view_create(context, w, h);
Figure: Scheduler Widget view frame
To fill out the text parts:
Implement the data_get_text() function to create the text you want to use. In this function, you can also choose the part name which you want to fill out.
Call the view_set_text() function with the part name and text you obtained.
In this example, the text to use is txt_day and the part name to fill out is widget.day.
txt_day = data_get_text("widget.day");
view_set_text(wid, "widget.day", txt_day);
Setting Touch Events
The view_set_event_callback() function controls the widget main operation that launches an application from the home screen.
The launch options are:
- WIDGET_EVENT_PRESSED for launch on a touch press event
- WIDGET_EVENT_RELEASED for launch on a touch release event
- WIDGET_EVENT_CLICKED for launch on a click event
In this example, the widget launches an application when the user clicks the widget:
view_set_event_callback(wid, "widget.event", WIDGET_EVENT_CLICKED, clicked_cb);