Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Calendar
  New Posts New Posts RSS Feed - SetCurSel() doesn't work
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

SetCurSel() doesn't work

 Post Reply Post Reply
Author
Message
tiratano View Drop Down
Newbie
Newbie


Joined: 15 April 2008
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote tiratano Quote  Post ReplyReply Direct Link To This Post Topic: SetCurSel() doesn't work
    Posted: 15 April 2008 at 10:27pm
Hi,
 
I want to change focused date, so I used SetCurSel() function.
However, it didn't work. Here is my code. Is there anyone who can point out the problem?
 
I'm using Xtreame ToolkitPro 2005 (10.3.1) on Windows XP Professional
 
==============================================
 
CXTPDatePickerControl wndDatePicker;
 
 CXTPWindowRect rcPopup(GetDlgItem(IDC_STARTDATE_SEARCH));
 CRect rc;
 wndDatePicker.GetMinReqRect(&rc);
 
 rc.InflateRect(0 ,0, 4, 4);
 rc.OffsetRect(rcPopup.right - rc.Width(), rcPopup.bottom);
 COleDateTime dt1(2008, 4, 1, 0, 0, 0);
 wndDatePicker.SetCurSel(dt1); // <= why it doesn't work?
 wndDatePicker.SetButtonsVisible(TRUE, FALSE);
 wndDatePicker.SetShowWeekNumbers(TRUE);
 CString strResult = _T("");
 if (wndDatePicker.GoModal(rc, this))
 {
  COleDateTime dtFrom;
  COleDateTime dtTo;
  if (wndDatePicker.GetSelRange(dtFrom, dtTo))
  {
   if (dtFrom == dtTo)
   {
    strResult.Format(_T("%4d-%02d-%02d"), 
     dtFrom.GetYear(), dtFrom.GetMonth(), dtFrom.GetDay());
   } else
   {
    // edit
    strResult.Format(_T("%4d.%02d.%02d - %4d.%02d.%02d"),
     dtFrom.GetYear(), dtFrom.GetMonth(), dtFrom.GetDay(),
     dtTo.GetYear(), dtTo.GetMonth(), dtTo.GetDay());
   }
  }
  else
   strResult = strCurrentText;
 }
 else
  strResult = strCurrentText;
 this->m_StartDateEdit.SetWindowText(strResult);
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.141 seconds.