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$, _
                 hWndParent, _
                    hCtlID%, _
                      Xpos%, _
                      Ypos%, _
                     Width%, _
                    Height%  _
                [,WinStyle%] _
              [,ExWinStyle%])

 Parameters:

  • hCtl The return value is a handle to the new control if the function succeeds. If the function fails, the return value is NULL.
  • Text$ Not used.
  • hWndParent Handle to the parent window of the control being created.
  • 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.
  • Xpos% Specifies the initial horizontal position of the control being created. X% is the x-coordinate of the upper-left corner of the control being created relative to the upper-left corner of the parent window's client area.
  • Ypos% Specifies the initial vertical position of the control being created. Y% is the initial y-coordinate of the upper-left corner of the control being created relative to the upper-left corner of the parent window's client area.
  • 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.
  • 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.
  • 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%. See your Win32 SDK or PSDK Reference help for more information about valid Window Styles.
  • ExWinStyle% [OPTIONAL] The default Extended Window Style for a BCX_DATEPICK control is WS_EX_CLIENTEDGE. See your Win32 SDK or PSDK Reference help for more information about valid Extended Window Styles.

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 Handle
 GLOBAL Datepick AS Handle
 
 SUB FORMLOAD
   Form1 = BCX_FORM("Datepicker", 0, 0, 120, 15)
   Datepick = BCX_DATEPICK("", Form1, 1002, 0, 0, 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.wMonth)) + "/" _
         + TRIM$(STR$(tim.wDay)) + "/" _
         + TRIM$(STR$(tim.wYear))
       END IF
     END IF
   END SELECT
 END EVENTS

For another example of the BCX_DATEPICK function see Demo.bas in the BCX\Gui_Demo\EZ_Gui folder.