Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CMonthCalCtrl MCN_SELECT problem

CMonthCalCtrl MCN_SELECT problem

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorial
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    asierra
    wrote on last edited by
    #1

    Hello all, I created a Month calendar control into my form, and I want to use it as a date picker, so when the user selects a date, I will fill other CEdit controls with the date selected. But I realize that within MCN_SELECT, the value associated with my Calendar Control, gets the wrong date. void CPlanmView::OnSelectMonthcalendar1(NMHDR* pNMHDR, LRESULT* pResult) { // Users Selects a Date, so MCN_SELECT triggers this. // User selected October 31, 2003 but returns // Feb,10,2004 *pResult = 0; UpdateData(); m_DiaPlm.Format("%d",m_CalendarVal.GetDay()); m_MesPlm.Format("%d",m_CalendarVal.GetMonth()); m_AnoPlm.Format("%d",m_CalendarVal.GetYear()); UpdateData(FALSE); } I have also seen the sample provided in the msdn, and it has the same problem, for this control. Any Ideas on how to workaround this issue. Best, -Alfredo

    C 1 Reply Last reply
    0
    • A asierra

      Hello all, I created a Month calendar control into my form, and I want to use it as a date picker, so when the user selects a date, I will fill other CEdit controls with the date selected. But I realize that within MCN_SELECT, the value associated with my Calendar Control, gets the wrong date. void CPlanmView::OnSelectMonthcalendar1(NMHDR* pNMHDR, LRESULT* pResult) { // Users Selects a Date, so MCN_SELECT triggers this. // User selected October 31, 2003 but returns // Feb,10,2004 *pResult = 0; UpdateData(); m_DiaPlm.Format("%d",m_CalendarVal.GetDay()); m_MesPlm.Format("%d",m_CalendarVal.GetMonth()); m_AnoPlm.Format("%d",m_CalendarVal.GetYear()); UpdateData(FALSE); } I have also seen the sample provided in the msdn, and it has the same problem, for this control. Any Ideas on how to workaround this issue. Best, -Alfredo

      C Offline
      C Offline
      Carlos Antollini
      wrote on last edited by
      #2

      Alfredo, I use that control and never had that problem... How you are initialing it. please put some of code best regards Carlos Antollini. Pi Five[^]Creator

      A 1 Reply Last reply
      0
      • C Carlos Antollini

        Alfredo, I use that control and never had that problem... How you are initialing it. please put some of code best regards Carlos Antollini. Pi Five[^]Creator

        A Offline
        A Offline
        asierra
        wrote on last edited by
        #3

        Carlos, Thanks for your reply, well I just created it with no code. I mean I put it on my form dragging the control. But I just saw that msdn sample and here is the code, still doesn't work in that way. BOOL CMonthCalPage::OnInitDialog() { CPropertyPage::OnInitDialog(); CWnd *pFrame = GetDlgItem(IDC_MCFRAME); CRect rcWnd; pFrame->GetClientRect(rcWnd); pFrame->DestroyWindow(); //pFrame was just a placeholder anyway. m_MonthCal.Create(WS_CHILD|WS_VISIBLE,CPoint(rcWnd.left,rcWnd.top),this,IDC_MONTHCAL); UpdateData(FALSE); return TRUE; } Thanks for helping Alfredo Best, Alfredo

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups