API Reference | developer.brewmp.com API Reference | developer.brewmp.com


API Reference


Brew Release
Brew MP 1.0.2
See Also
AEECLSID_JulianDateWidget AEECLSID_JulianTimeWidget Events IDATECTL_HandleEvent IDATECTL_Release IDATECTL_SetDate IDATECTL_SetJulianDay IDATECTL_SetRect ISHELL_CreateInstance
The IDateCtl interface is deprecated. Refer to the AEECLSID_JulianDateWidget (and AEECLSID_JulianTimeWidget) class topics instead.
Date controls are used in interfaces that require the device user to choose a date. There are two types of date controls (you choose the type you want by specifying its ClassID when you create an instance of the date control):
- A standard date control (ClassID AEECLSID_DATECTL) allows the device user
to use the UP, DOWN, LEFT, and RIGHT keys to choose the specific month, day, and year.
- A date pick control (ClassID AEECLSID_DATEPICKCTL) displays a monthly calendar;
the arrow keys can be used to choose the day of the month, or to scroll to the next or previous month.
IDATECTL_HandleEvent() handles the AVK_SELECT, AVK_UP, AVK_DOWN, AVK_LEFT and AVK_RIGHT keys. When it receives AVK_SELECT, the date control sends an EVT_COMMAND to signal your application that the device user has selected a date, provided you have enabled command sending (see later in this section); then use one of the IDateCtl functions to retrieve the selected date value. For standard date controls, control tabbing events (EVT_CTL_TAB) are sent when the device user presses AVK_LEFT while selecting the month or AVK_RIGHT while selecting the year. Use these events to allow the device user to navigate between controls in a multi-control screen (dialogs handle EVT_CTL_TAB events and change control focus as needed).
IDateCtl Interface implements several functions in addition to those in the IControl Interface.
- IDATECTL_SetTitle() specifies a title that appears above the date control.

- IDATECTL_SetDate() sets the date stored in the control to the value specified
in the function's integer month, day, and date parameters.
- IDATECTL_GetDate() retrieves the control's current date in the same format.

- IDATECTL_SetJulianDay() and IDATECTL_GetJulianDay() are similar, except that
the control's date is set and retrieved in number of days since the first Sunday before January 1, 1970.
- IDATECTL_GetDayOfWeek() returns the day of the week corresponding to the control's
current date.
- The date control's current date, day, or month can also be stored into a character
string with the functions IDATECTL_GetDateString(), IDATECTL_GetDayString(), and IDATECTL_GetMonthString(). The date string can be in any of several different formats (for example, specify the order of the date, month, and year, and whether the full month name or a three-letter abbreviation is used).
- For date pick controls, IDATECTL_SetActiveDayMask() causes the specified days
of the month to be displayed with a dot (.) at the upper left hand corner; this can be used to designate holidays, For example, the function is called with a 32-bit parameter that specifies which of the days of the month is displayed in this way.
- IDATECTL_EnableCommand() allows the disabling or enabling of command sending
when the device user presses the AVK_SELECT key while the date control is active (command sending is disabled by default). This function also lets you specify the command ID (for example, the wParam value that is sent along with the EVT_COMMAND when your application's IAPPLET_HandleEvent() function is called).

To use a date control:

1. Call ISHELL_CreateInstance() to create an instance of a date control, specifying the ClassID of either a standard or date pick date control.
2. Call IDATECTL_SetRect() to specify the screen rectangle that contains the control.
3. Call IDATECTL_SetDate() or IDATECTL_SetJulianDay() to specify an initial date value for the control if necessary (if you do not specify one, the control's date fields appear blank initially).
4. Call IDATECTL_SetActive() to make the control active so that it can receive key events generated as the device user chooses a date value. Your application must send the control these events using the IDATECTL_HandleEvent() while the control is active.
5. When the device user has chosen a date, call one of the date retrieval functions mentioned above to access its value in the specified format. The device user's selection of a date may be signaled through an EVT_COMMAND event if command sending is enabled, or by the device user exiting the screen that contains the date control.
6. When you no longer need the date control, call IDATECTL_Release() to release it.