Announcement

Collapse
No announcement yet.

Send date to calender-control

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Send date to calender-control

    I've got a nice working commctrl calender that pops up as soon as
    somebody clicks the date-field. Sometimes this field is already
    filled, and then I want the calender to pop-up with that particular
    date. Anybody knows how to control that ?

    Thanks again in advance. Needless to say how valueble such a forum is.


    ------------------
    Herman
    You gotta walk and don't loop back.
    You gotta run, and don't loop back.

  • #2
    Not sure this is what you mean, but following is from a file-stamper
    I once did, using the calender in text-field mode with up/down control:
    Code:
      LOCAL hWnd1 AS LONG, hWnd2 AS LONG, st AS SYSTEMTIME
      CONTROL ADD "SysDateTimePick32", hDlg, %ID_CALDATE, "", 190, 12, 70, 14, %WS_CHILD OR _
                  %WS_BORDER OR %WS_TABSTOP OR %WS_VISIBLE OR %DTS_UPDOWN OR %DTS_SHORTDATEFORMAT, CALL DlgCallback
      CONTROL ADD "SysDateTimePick32", hDlg, %ID_CALTIME, "", 190, 27, 70, 14, %WS_CHILD OR _
                  %WS_BORDER OR %WS_TABSTOP OR %WS_VISIBLE OR %DTS_TIMEFORMAT, CALL DlgCallback
      CONTROL HANDLE hDlg,%ID_CALDATE TO hWnd1
      CONTROL HANDLE hDlg,%ID_CALTIME TO hWnd2
      st.wYear         = 2001
      st.wMonth        = 04
      st.wDay          = 01
      st.wHour         = 5
      st.wMinute       = 20
      st.wSecond       = 0
      st.wMilliseconds = 0
      DateTime_SetSystemTime hWnd1, %GDT_VALID, BYVAL VARPTR(st)
      DateTime_SetSystemTime hWnd2, %GDT_VALID, BYVAL VARPTR(st)
    and another function from same prog:
    Code:
    '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
    ' Get/set current date/time to the Calendar control's text fields
    '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
    SUB GetCurDateTime
      LOCAL st AS SYSTEMTIME
     
      CALL GetLocalTime(st)
      DateTime_SetSystemTime GetDlgItem(hDlg, %ID_CALDATE), %GDT_VALID, BYVAL VARPTR(st)
      DateTime_SetSystemTime GetDlgItem(hDlg, %ID_CALTIME), %GDT_VALID, BYVAL VARPTR(st)
    END SUB

    ------------------

    Comment


    • #3
      Okay, just tested. Saw you meant full calendar. Following seems to
      work, just make sure to uncomment both %NODATETIMEPICK and %NOMONTHCAL,
      so both these modules are included.
      Code:
        LOCAL st AS SYSTEMTIME
        st.wYear         = 2001
        st.wMonth        = 04
        st.wDay          = 01
        DateTime_SetSystemTime GetDlgItem(hDlg, %ID_CALENDAR), %GDT_VALID, BYVAL VARPTR(st)

      ------------------

      Comment


      • #4
        Thanks again Borje, as usual your help on this stuff is really
        good, I'll give it a go.



        ------------------
        Herman
        You gotta walk and don't loop back.
        You gotta run, and don't loop back.

        Comment

        Working...
        X