|
Date and time control help
Function help:
Real API_DateTime_Create (Real Parent Handle, Real X, Real Y, Real Width, Real Height, Real Style Flags, Real Extended Style Flags);
This function creates a new date and time picker control.
Argument list:
(0) Parent Handle: Identifies the window handle of the window to create this control on.
(1) X: The horizontal position of the control in pixels, relative to the parent window.
(2) Y: The vertical position of the control in pixels, relative to the parent window.
(3) Width: The horizontal size of the control in pixels.
(4) Height: The vertical size of the control in pixels.
(5) Style Flags: The style flags, supports the Global Control Styles and the following styles:
DTS_APPCANPARSE
Allows the owner to parse user input and take necessary action. It enables users to edit within the client area of the control when they press the F2 key.
DTS_LONGDATEFORMAT
Displays the date in long format, which produces output like "Friday, April 19, 1996".
DTS_RIGHTALIGN
The drop-down month calendar will be right-aligned with the control instead of left-aligned, which is the default.
DTS_SHOWNONE
It is possible to have no date currently selected in the control. With this style, the control displays a check box that is automatically selected whenever a date is picked or entered. If the check box is subsequently deselected, the application cannot retrieve the date from the control because, in essence, the control has no date.
DTS_SHORTDATEFORMAT
Displays the date in short format, which produces output like "4/19/96".
DTS_SHORTDATECENTURYFORMAT
Similar to the DTS_SHORTDATEFORMAT style, except the year is a four-digit field. The output looks like: "4/19/1996".
DTS_TIMEFORMAT
Displays the time, which produces output like "5:31:42 PM".
DTS_UPDOWN
Places an up-down control to the right of the control to modify date-time values. This style can be used in place of the drop-down month calendar, which is the default style.
Style flags can be separated by a bitwise or '|' operator.
(6) Extended Style Flags: This can be any combination of the Global Extended Control Styles.
Return value:
If this function succeeds, it returns the Control ID of the control, otherwise it returns 0.
Real API_DateTime_SetRange ( Real Control ID, Real Range Type, Real Year,
Real Month, Real Day,Real Hour,Real Minute,Real Second,Real Milliseconds )
This function changes the minimum or maximum date that can be entered into the control.
Argument list:
(0) Control ID: The control ID returned by API_DateTime_Create.
(1) Range type: 0 = Set the minimum part of the range, 1 = Set the maximum part of the range.
(2) Year: The years of the date
(3) Month: The months of the date
(4) Day: The
days of the date
(5) Hour: The hours of the date
(6) Minute: The minutes of the date
(7) Second:
The seconds of the date
(8) Miliseconds: The miliseconds of the date
Return value:
Returns true (1) when succesful or false (0) otherwise.
Real API_DateTime_GetRange ( Real Control ID, Real Range Type, Real Date Part )
This function returns the current minimum or maximum date that can be entered into the control.
Argument list:
(0) Control ID: The control ID returned by API_DateTime_Create.
(1) Range type: 0 = Get the minimum part of the range, 1 = Get the maximum part of the range.
(2) Date part, one of the following:
0: Return the year.
1: Return the month
2: Return the day
3: Return the hour
4: Return the minute
5: Return the second
6: Return the miliseconds
Return value:
Returns the date part.
Real API_DateTime_SetTimes ( Real Control ID,Real Year,
Real Month, Real Day,Real Hour,Real Minute,Real Second,Real Milliseconds )
This function changes the current date entered into the control.
Argument list:
(0) Control ID: The control ID returned by API_DateTime_Create.
(1) Year: The years of the date
(2) Month: The months of the date
(3) Day: The
days of the date
(4) Hour: The hours of the date
(5) Minute: The minutes of the date
(6) Second:
The seconds of the date
(7) Miliseconds: The miliseconds of the date
Return value:
Returns true (1) when succesful or false (0) otherwise.
Real API_DateTime_GetTimes ( Real Control ID,Real Date part)
This function returns the current date entered into the control.s
Argument list:
(0) Control ID: The control ID returned by API_DateTime_Create.
(1) Date part, one of the following:
0: Return the year.
1: Return the month
2: Return the day
3: Return the hour
4: Return the minute
5: Return the second
6: Return the miliseconds
Return value:
Returns the date part.
Real API_DateTime_SetColor ( Real Control ID,Real Color part, Real Color)
This function changes the colors inside the date and time control.
Argument list:
(0) Control ID: The control ID returned by API_DateTime_Create.
(1) Color part, one of the following:
MCSC_BACKGROUND
Set the background color displayed between months.
MCSC_MONTHBK
Set the background color displayed within the month.
MCSC_TEXT
Set the color used to display text within a month.
MCSC_TITLEBK
Set the background color displayed in the calendar's title.
MCSC_TITLETEXT
Set the color used to display text within the calendar's title.
MCSC_TRAILINGTEXT
Set the color used to display header day and trailing day text. Header and trailing days are the days from the previous and following months that appear on the current month calendar.
(2) Color: The new color.
Return value:
Returns the previous color when succesful, or -1 otherwise.
Real API_DateTime_GetColor ( Real Control ID,Real Color part)
This function changes the colors inside the date and time control.
Argument list:
(0) Control ID: The control ID returned by API_DateTime_Create.
(1) Color part, one of the following:
MCSC_BACKGROUND
Get the background color displayed between months.
MCSC_MONTHBK
Get the background color displayed within the month.
MCSC_TEXT
Get the color used to display text within a month.
MCSC_TITLEBK
Get the background color displayed in the calendar's title.
MCSC_TITLETEXT
Get the color used to display text within the calendar's title.
MCSC_TRAILINGTEXT
Get the color used to display header day and trailing day text. Header and trailing days are the days from the previous and following months that appear on the current month calendar.
Return value:
Returns the color when succesful, or -1 otherwise.
Real API_DateTime_SetFont ( Real Control ID,Real Font Resource Handle)
This function changes the current font of a date and time control.
To create fonts, use API_Resource_CreateFont.
Return value:
Always returns zero.
Real API_DateTime_GetFont ( Real Control ID)
This function gets the current font resource handle of a date and time control.
Return value:
Returns the font resource handle.
Secondary check commands for date and time pickers:
DTN_CLOSEUP
Sent by a date and time picker (DTP) control when the user closes the drop-down month calendar. The month calendar is closed when the user chooses a date from the month calendar or clicks the drop-down arrow while the calendar is open.
DTN_DATETIMECHANGE
Sent by a date and time picker (DTP) control whenever a change occurs.
DTN_DROPDOWN
Sent by a date and time picker (DTP) control when the user activates the drop-down month calendar.
DTN_USERSTRING
Sent by a date and time picker (DTP) control when a user finishes editing a string in the control. This notification message is only sent by DTP controls that are set to the DTS_APPCANPARSE style
NM_KILLFOCUS
Notifies that the control has lost the input focus.
NM_SETFOCUS
Notifies that the control has received the input focus.
Example:
Command = API_Check_Command (1);
if ( Command == DateTime1 )
{
Second = API_Check_SecondaryCommand (1);
if ( Second == DTN_CLOSEUP)
{
show_message ("You closed up the up the calendar.");
}
} |
Example code:
DateTime1 = API_DateTime_Create (Win,300,60,300,20,DTS_LONGDATEFORMAT);
API_DateTime_SetRange (DateTime1,0,2006,1,1,0,0,0,0);
API_DateTime_SetRange (DateTime1,1,2007,1,1,0,0,0,0);
|
is
Return to help index
|
|