PlanetSquires Forums

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: DateTimePicker question  (Read 459 times)

Sergio Tallone

  • Little Newbie
  • *
  • Posts: 8
DateTimePicker question
« on: March 06, 2013, 12:46:46 PM »

Good morning to all,
if possible I would like to know how can I read the notification message DTN_CLOSEUP% using a DateTimePicker control type. I tried in vain to use the FORM1_DATETIMEPICKER1_CUSTOM() function but obviously I'm doing something wrong (the same code works when used in a standard DDT dialog callback). Below is my sample code
Code: [Select]
FUNCTION FORM1_DATETIMEPICKER1_CUSTOM ( _
                                      ControlIndex  AS LONG,  _  ' index in Control Array
                                      hWndForm      AS DWORD, _  ' handle of Form
                                      hWndControl   AS DWORD, _  ' handle of Control
                                      wMsg          AS LONG,  _  ' type of message
                                      wParam        AS DWORD, _  ' first message parameter
                                      lParam        AS LONG   _  ' second message parameter
                                      ) AS LONG

   LOCAL pNmDt    AS NMDATETIMECHANGE PTR
   if  wMsg =  %WM_NOTIFY then
      pNmDt = lParam
      if  @pNmDt.hdr.code = %DTN_CLOSEUP then
        ztrace "Ok!"
     end if
  end if

END FUNCTION

Thanks

Sergio
Logged

Rudolf Furstauer

  • Junior Member
  • **
  • Posts: 109
Re: DateTimePicker question
« Reply #1 on: March 06, 2013, 02:08:18 PM »

You can use the notification on the form:
Code: [Select]
'--------------------------------------------------------------------------------
Function FORM1_CUSTOM ( _
                      hWndForm      As Dword, _  ' handle of Form
                      wMsg          As Long,  _  ' type of message
                      wParam        As Dword, _  ' first message parameter
                      lParam        As Long   _  ' second message parameter
                      ) As Long

    Local hdrX As NMDATETIMECHANGE Ptr
'--------------------------------------

   Select Case wMsg
     
      'Use this to detect changes in the calendar 
      Case %WM_Notify       
         hdrX = lParam

        'Get selected date/time
        Select Case @hdrX.hdr.idfrom
       
            Case IDC_FORM1_DATETIMEPICKER1

                'Get selected date/time
                Select Case @hdrX.hdr.Code
               
                    Case %DTN_DATETIMECHANGE
                        dp_("%DTN_DATETIMECHANGE")
       
                    Case %DTN_CLOSEUP
                        dp_("%DTN_CLOSEUP")
       
                End Select       
        End Select           
   End Select   
   

Rudolf Fuerstauer
Logged

Sergio Tallone

  • Little Newbie
  • *
  • Posts: 8
Re: DateTimePicker question
« Reply #2 on: March 07, 2013, 04:25:06 AM »

Rudolf,
 thanks for your reply. I thought the best way to catch the notify messages of the datetimepicker control, was his custom function

bye

Sergio
Logged