BCX_DATEPICK function
Purpose:
BCX_DATEPICK creates a date and time picker control.
The date is displayed in long format, which produces output like
"Friday, April 19, 1996".
Syntax:
hCtl = BCX_DATEPICK(Text AS STRING, _
hwndParent AS HWND, _
hCtlID AS INTEGER, _
Xpos AS INTEGER, _
Ypos AS INTEGER, _
Width AS INTEGER, _
Height AS INTEGER _
[, WinStyle AS INTEGER] _
[, ExWinStyle AS INTEGER])
Return Value:
- Data type: HWND
hCtl The handle of the datepick control if
the function succeeds. If the function fails, the return value is
NULL.
Parameters:
- Data type: STRING
Text Not used.
- Data type: HWND
hwndParent The handle of the parent window
of the control being created.
- Data type: INTEGER
hCtlID Specifies the identifier of the
control being created. The identifier is an integer value used by
the control being created to notify its parent about events. The
identifier must be unique for each control created with the same
parent window.
- Data type: INTEGER
Xpos Specifies the initial horizontal
x-coordinate value of the upper-left corner location of the button
being created relative to the upper-left corner of the parent
window's client area.
- Data type: INTEGER
Ypos Specifies the initial vertical
y-coordinate value of the upper-left corner location of the control
being created relative to the upper-left corner of the parent
window's client area.
- Data type: INTEGER
Width Specifies the width, in device units
or, if the PIXELS optional parameter was specified in the
GUI statement, in pixels, of the control being
created.
- Data type: INTEGER
Height Specifies the height, in device units
or, if the PIXELS optional parameter was specified in the
GUI statement, in pixels, of the control being
created.
- Data type: INTEGER
WinStyle [OPTIONAL]
If the WinStyle parameter is used, the
default Window Style for a BCX_DATEPICK
control, WS_CHILD | WS_TABSTOP | WS_VISIBLE | DTS_LONGDATEFORMAT,
is replaced with the value in WinStyle. For
more information, visit the Microsoft Date and Time Picker Control Styles
webpage and the Microsoft Window Styles webpage.
- Data type: INTEGER
ExWinStyle [OPTIONAL] The default Extended Window Style or a
BCX_DATEPICK control is WS_EX_CLIENTEDGE. For more
information, visit the Microsoft Extended Window Styles webpage.
|
Remarks:
The default window Style for a BCX_DATEPICK
control also can be changed by using the MODSTYLE
function.
Example:
GUI "Datepick"
GLOBAL Form1 AS HWND
GLOBAL Datepick AS HWND
SUB FORMLOAD
Form1 = BCX_FORM("Datepicker", 0, 0, 145, 40)
Datepick = BCX_DATEPICK("", Form1, 1002, 10, 10, 120, 12, _
WS_CHILD | WS_TABSTOP | WS_VISIBLE | DTS_SHORTDATECENTURYFORMAT)
CENTER(Form1)
SHOW(Form1)
END SUB
BEGIN EVENTS
SELECT CASE CBMSG
CASE WM_NOTIFY
DIM RAW lpNMFormat = (LPNMDATETIMEFORMAT)lParam AS LPNMDATETIMEFORMAT
IF lpNMFormat->nmhdr.idFrom = 1002 THEN
IF lpNMFormat->nmhdr.code = DTN_DATETIMECHANGE THEN
DIM RAW lpChange = (LPNMDATETIMECHANGE)lParam AS LPNMDATETIMECHANGE
DIM tim AS SYSTEMTIME
SendMessage(Datepick, DTM_GETSYSTEMTIME, 0, &tim)
BCX_SET_TEXT Form1, "Date is " + TRIM$(STR$(tim.wYear)) + "/" + TRIM$(STR$(tim.wMonth)) + "/" _
+ TRIM$(STR$(tim.wDay))
END IF
END IF
END SELECT
END EVENTS
For another example of the BCX_DATEPICK
function see Demo.bas.